You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS and Python version: Ubuntu 22.04, Python 3.10.12
Reproduce the issue by running the following without root privileges:
pip install aestream
or
pip install --user aestream
Then running aestream fails with:
user@computer:~$ aestream
Traceback (most recent call last):
File "/home/user/.local/bin/aestream", line 8, in <module>
os.execv(
FileNotFoundError: [Errno 2] No such file or directory
Currently, the code of aestream (in /home/user/.local/bin/aestream) is:
#!/usr/bin/python3
import os
import sys
import sysconfig
if __name__ == "__main__":
os.execv(
os.path.join(sysconfig.get_path("platlib"), 'aestream.scripts/aestream'),
sys.argv,
)
sysconfig.get_path("platlib") returns '/usr/local/lib/python3.10/dist-packages'. However, pip installed the aestream package to '/home/user/.local/lib/python3.10/site-packages'.
I have fixed the issue in my AEStream installation by trying all the possible dist-packages and site-packages paths in the aestream code as follows:
#!/usr/bin/python3
import os
import sys
import site
import sysconfig
if __name__ == "__main__":
packages_paths = [site.getusersitepackages()]
packages_paths.append(sysconfig.get_path("platlib"))
packages_paths.extend(site.getsitepackages())
aestream_paths = [
os.path.join(packages, 'aestream.scripts/aestream')
for packages in packages_paths]
succeeded = False
for path in aestream_paths:
try:
os.execv(path, sys.argv)
succeeded = True
break
except FileNotFoundError:
pass
if not succeeded:
raise RuntimeError(
f"I have not found the aestream executable among the paths: "
f"{aestream_paths}")
Thank you so much for your elaborate error report.
I reproduced the behavior in a Docker container, and it's clear that the platlib environmental variable is wrong. The correct fix to this, IMO, would be to update the script to also search in .local, pretty much what you're suggesting.
That script comes from somewhere upstream. AEStream uses scikit-build-core to build the distribution and cibuildwheels to build the wheels, but it's honestly a little unclear to me exactly where in the (huge) build stack the script is being generated. I wrote the pypa community on their discord and will follow up on this. If you have any input/ideas I'm all ears! 👂
I linked to the issue in auditwheel. A better variation on this fix would be to check other schemes; this one is sysconfig.get_path("posix_user", "platlib").
The core problem is the executable links to other things in platlib, which is invalid; you should swap it for a console entry point wrapping the executable (which is then placed in platlib so relative paths work), or statically link so that it doesn't depend on platlib. auditwheel is trying to fix this for you, and is applying a fix that ignores user platlib.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
OS and Python version: Ubuntu 22.04, Python 3.10.12
Reproduce the issue by running the following without root privileges:
or
Then running
aestream
fails with:Currently, the code of
aestream
(in/home/user/.local/bin/aestream
) is:sysconfig.get_path("platlib")
returns'/usr/local/lib/python3.10/dist-packages'
. However, pip installed the aestream package to'/home/user/.local/lib/python3.10/site-packages'
.I have fixed the issue in my AEStream installation by trying all the possible dist-packages and site-packages paths in the
aestream
code as follows:These are all the possible paths on my system:
The text was updated successfully, but these errors were encountered: