cs2tracker icon indicating copy to clipboard operation
cs2tracker copied to clipboard

Issues with getting the app to start on Arch

Open TheBonheurs opened this issue 11 months ago • 19 comments

Hey, running the executable fails and when I tried using the packaged app with pipx I get various tkinter related errors (icon_file missing and if I substitute I get a crontab missing error).

I have tk installed systemwide and it worked in another app so I'm not sure what else I can try.. Do you have any ideas?

TheBonheurs avatar Jan 02 '26 04:01 TheBonheurs

Hey, unfortunately I haven't been able to do much testing on Linux apart from some basic functionality tests on Ubuntu.

I was kind of assuming that most people playing CS2 would be running Windows which is why the application is mostly catered towards that.

I could try to look into it if you provide some specific error messages though.

ashiven avatar Jan 02 '26 13:01 ashiven

I understand. However I must say I don't regret switching since cs performance is better than on windows 👀

I tried again using a temp venv and by stubbing some files of tkinter etc. I managed to get it to run! Haven't linked my steam inventory or anything yet so I can't comment on how well the app functions.

Will probably try to install it on windows when I get the chance and test it out. Thanks anyways :)

TheBonheurs avatar Jan 02 '26 17:01 TheBonheurs

Awesome! If you would like, you could also open a PR with your changes and I might be able to merge it so others won't face the same issues as you :)

ashiven avatar Jan 02 '26 18:01 ashiven

I think if you stub this file https://github.com/ashiven/cs2tracker/blob/main/cs2tracker/app/app.py#L67 it's enough.

so window.iconbitmap(default="path/to/your/file")

But I wouldn't add this as a PR as it does not make any sense and is very dirty.

The issue comes from the fact that arch based distros use pacman for systemwide packages and somehow maybe pipx interpreter messe with the default paths.. but I'm new to Arch still so maybe someone more experienced can chime in and add a proper fix.

TheBonheurs avatar Jan 02 '26 19:01 TheBonheurs

It seems like the problem actually arises with the way the icon path is inferred at startup inside of cs2tracker/constants.py.

Specifically, the icon path is defined in lines 152,153, and 163 as follows:

MODULE_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_DIR = os.path.dirname(MODULE_DIR)
ICON_FILE = os.path.join(PROJECT_DIR, "assets", "icon.ico")

Now it could be that the way pip installs the application actually makes it so that the project directory is not actually two levels above the constants.py file as assumed in the code snippet here and therefore the path ends up being incorrect.

So it might be helpful if you could figure out where pip actually installed the application for you and to make sure that the path to the icon file is actually being constructed correctly here.

ashiven avatar Jan 02 '26 20:01 ashiven

Yeah your suspicion is correct. Under pipx the project root is no longer two levels above constants.py, so PROJECT_DIR = os.path.dirname(MODULE_DIR) resolves to site-packages, not the repository root. Since assets/ is not installed there, the constructed icon path is invalid.

Running pipx runpip cs2tracker show cs2tracker gives the following:

Name: cs2tracker
Version: 2.1.19
Summary: Tracking the steam market prices of CS2 items
Home-page: https://github.com/ashiven/cs2tracker
Author: Jannik Novak
Author-email: [email protected]
License: 
Location: /home/myusername/.local/share/pipx/venvs/cs2tracker/lib/python3.13/site-packages
Requires: beautifulsoup4, CurrencyConverter, matplotlib, nodejs-bin, numpy, Requests, requests-cache, rich, sv_ttk, tenacity, tksheet, ttk-text, urllib3
Required-by: `

And here is the folder layout:

drwxr-xr-x    - myusername  3 jan 02:49  __pycache__
drwxr-xr-x    - myusername  3 jan 02:49  app
drwxr-xr-x    - myusername  3 jan 02:50  data
drwxr-xr-x    - myusername  3 jan 02:49  scraper
drwxr-xr-x    - myusername  3 jan 02:49  util
.rw-r--r--    0 myusername  3 jan 02:49  __init__.py
.rw-r--r--  249 myusername  3 jan 02:49  __main__.py
.rw-r--r--  513 myusername  3 jan 02:49  _version.py
.rw-r--r--  11k myusername  3 jan 02:49  config.py
.rw-r--r-- 9,5k myusername  3 jan 02:49  constants.py
.rw-r--r-- 6,0k myusername  3 jan 02:49  logs.py
.rw-r--r-- 1,0k myusername  3 jan 02:49  main.py

and the stacktrace, where you can see where the exception is thrown from (cs2tracker/app/app.py):

 File "/home/myusername/.local/share/pipx/venvs/cs2tracker/lib/python3.13/site-packages/cs2tracker/app/app.py", line 67, in _configure_window
    icon = tk.PhotoImage(file=ICON_FILE)
  File "/usr/lib/python3.13/tkinter/__init__.py", line 4303, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is probably not a Tkinter or Arch issue then? The assets need to be shipped as package data if that is possible.

TheBonheurs avatar Jan 03 '26 17:01 TheBonheurs

You're exactly right. I guess the last time I tested the application installed with pip was before I added the icon to it.

The simplest solution for the problem would be to add a copy of the icon file into the cs2tracker/data directory and then modify the definition of the ICON_FILE constant in line 163 accordingly.

I think it should be a relatively simple fix that I could add tomorrow or when I find the time or if you would like you could also implement it and I would merge it in a PR. :)

ashiven avatar Jan 03 '26 22:01 ashiven

@TheBonheurs The issue should now be fixed in the newest version.

Please test if it works for you now if you don't mind and let me know so I can close this issue.

ashiven avatar Jan 05 '26 16:01 ashiven

Sorry for late response. I'll try to test it this week but I'm a bit busy with work 😢

TheBonheurs avatar Jan 05 '26 20:01 TheBonheurs

Oh don't worry, take as much time as you need, I am not in a hurry. ^^

ashiven avatar Jan 05 '26 23:01 ashiven

Hi, I tried the app on arch but it was not working. I had to sudo pacman -S tk cronie to get tk and crontab working. The window.iconbitmap(default=ICON_FILE) line was also giving me an error because tkinter on linux uses a command line arguement which is exclusive to windows. According to me, the best way to sort the icon problem would be to convert the ico to a png and:

img = tk.PhotoImage(file=ICON_FILE)
window.iconphoto(True, img)
window._icon_reference = img # Keep reference to stop icon from disappearing

ksharizard avatar Jan 11 '26 09:01 ksharizard

Hi, I tried the app on arch but it was not working. I had to sudo pacman -S tk cronie to get tk and crontab working. The window.iconbitmap(default=ICON_FILE) line was also giving me an error because tkinter on linux uses a command line arguement which is exclusive to windows. According to me, the best way to sort the icon problem would be to convert the ico to a png and:

img = tk.PhotoImage(file=ICON_FILE)
window.iconphoto(True, img)
window._icon_reference = img # Keep reference to stop icon from disappearing

Hi, if I remember correctly, I had previously been using a png file in the exact way that you are suggesting but it lead to some issue with cross-platform compatibility or with building the executable.

Could you post the exact error you are getting with the ico file so we could try to figure out a way to get it working with that?

ashiven avatar Jan 11 '26 16:01 ashiven

The error I am getting:

  File "/home/user/.local/src/tracker/.venv/lib/python3.14/site-packages/cs2tracker/app/app.py", line 68, in _configure_window
    window.iconbitmap(default=ICON_FILE)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/tkinter/__init__.py", line 2287, in wm_iconbitmap
    return self.tk.call('wm', 'iconbitmap', self._w, '-default', default)
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: wrong # args: should be "wm iconbitmap window ?bitmap?"

ksharizard avatar Jan 11 '26 19:01 ksharizard

File "/home/user/.local/src/tracker/.venv/lib/python3.14/site-packages/cs2tracker/app/app.py", line 68, in _configure_window window.iconbitmap(default=ICON_FILE) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.14/tkinter/init.py", line 2287, in wm_iconbitmap return self.tk.call('wm', 'iconbitmap', self._w, '-default', default) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _tkinter.TclError: wrong # args: should be "wm iconbitmap window ?bitmap?"

It seems like the following is the issue at hand:

https://stackoverflow.com/a/20860521

I will try to fix it as soon as possible or if you want to you could create a PR for it that I would then merge. :)

ashiven avatar Jan 11 '26 20:01 ashiven

I had gone through that answer and I saw that switching to xbm could help. However, xbm only support black and white icons which is an issue. Also seems trivial to have two different icon files for two different systems. Do you remember what compatibility/workflow error you were running into with the png (as png seems like the easiest solution)?

ksharizard avatar Jan 11 '26 21:01 ksharizard

I have tried to make it work with xbm, png, and gif files and the only file formats that seem to work for me on ubuntu are png and gif in the way you suggested. It should now be fixed in the latest version.

Mind you that there is another issue I stumbled across testing on ubuntu with two monitors, which is that the application window gets centered in between the monitors. This only seems to happen on linux though and I have not looked into a fix yet.

ashiven avatar Jan 11 '26 22:01 ashiven

@TheBonheurs @ksharizard

Closing this issue now. Please comment if there are any further issues you encounter.

ashiven avatar Jan 14 '26 20:01 ashiven

Hi sorry it took so long to respond 😅

I reinstalled the app again with pipx and it runs without errors at startup! (the installation takes about 2 mins now @ashiven ) Have yet to try it out with my own inventory tho.

@ksharizard I didn't mention it in my original post but yes I also needed to install cronie. I think this is for the discord hook? Or running as bg task?

Let me know if you need some fresh eyes on the issues you still have - I can take a look at it this weekend.

Ps. I am using hyprland as my wm and have no issues on my 3 monitor setup with centering etc.

TheBonheurs avatar Jan 15 '26 20:01 TheBonheurs

Hi sorry it took so long to respond 😅

I reinstalled the app again with pipx and it runs without errors at startup! (the installation takes about 2 mins now @ashiven ) Have yet to try it out with my own inventory tho.

@ksharizard I didn't mention it in my original post but yes I also needed to install cronie. I think this is for the discord hook? Or running as bg task?

Let me know if you need some fresh eyes on the issues you still have - I can take a look at it this weekend.

Ps. I am using hyprland as my wm and have no issues on my 3 monitor setup with centering etc.

Great to hear that it works for you now!

It is interesting that you both needed to install cronie. Does crontab or some of its utility not come installed per default on Arch? Because the background task does indeed run via a crontab on Linux.

I believe the monitor issue on Linux came from the fact that multiple monitors were treated as a single, combined monitor which would then be used for centering instead of just the main monitor. This would explain why the centering works with 3 monitors but not with 2.

Other than that, there is a known bug currently that a CS:GO Weapon Case gets imported that people don't actually own so if that happens to you when importing your inventory it might be very helpful if you let me know! :)

ashiven avatar Jan 16 '26 03:01 ashiven