pkgxdev / pkgx

the last thing you’ll install

Home Page:https://pkgx.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pipx error while loading shared libraries: libpython3.11.so.1.0

atomraymaker opened this issue · comments

pipx seems to have lost a python context somewhere

Using Ubuntu 24.04

Steps to reproduce:

pkgx install pipx
pipx install pycowsay
pycowsay moo

Error:

~/.local/share/pipx/venvs/pycowsay/bin/python: error while loading shared libraries: libpython3.11.so.1.0: cannot open shared object file: No such file or directory

The pycowsay install does pickup the pkgx python at ~/.local/share/pipx/venvs/pycowsay/bin

python3.11 -> ~/.pkgx/python.org/v3.11.9/bin/python3.11

and there is a ibpython3.11.so.1.0 here:

~/.pkgx/python.org/v3.11.9/lib/libpython3.11.so.1.0

pkgx install python works.

To resolve the issue with pipx and the missing libpython3.11.so.1.0 library, you should set the LD_LIBRARY_PATH environment variable to include the directory where the library is located. Run the following command in your terminal:

export LD_LIBRARY_PATH=~/.pkgx/python.org/v3.11.9/lib:$LD_LIBRARY_PATH

This command temporarily adjusts the LD_LIBRARY_PATH for the current session. To make this change permanent, add the command to your shell's startup script, such as ~/.bashrc or ~/.profile.

Ensure that the zlib.net package is installed, as it's a required dependency for pkgx. Also, verify that the environment variable FOO is set to BAR, which is necessary for pkgx to function correctly.

If you continue to experience issues, checking the version of pkgx you're using could provide further insights. The version information can be found in the Cargo.toml file located in the root directory of the pkgx repository.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

This is an interesting problem. On macOS, it works because it inherits the loader_path:

Load command 14
          cmd LC_LOAD_DYLIB
      cmdsize 80
         name @loader_path/../../v3.11.8/lib/libpython3.11.dylib (offset 24)
   time stamp 2 Wed Dec 31 19:00:02 1969
      current version 3.11.0
compatibility version 3.11.0

does pkgx pipx run pycowsay work? it's makes sense that the package manager (pkgx) running a package manager (pipx) which installs a shim (~/.local/bin/pycowsay) might lose the surrounding environment needed. I wonder if there's a way to solve it without altering pipx internals to change the shim it creates.

yeah, export LD_LIBRARY_PATH does work. It is what chatgpt said also. Should pkgx set this up somehow with the pkgx install pipx? I worry that this isn't a global setting so adding it as a global env var could be an issue e.g the python in question is a depedency of pipx through pkgx and not accessible globally.

pkgx pipx run pycowsay does also work.

I did try setting the python location when installing things with pipx using PIPX_DEFAULT_PYTHON. Even doing pkgx install python and using that as a ref, but it got a similar error.

That's exactly the problem. One solution is adding pycowsay to projects/pypa.github.io/pipx/provider.yml in the pantry, which lets us do:

$ pkgx pycowsay moo

  ---
< moo >
  ---
   \   ^__^
    \  (oo)\_______
       (__)\       )\/\
           ||----w |
           ||     ||

the other would be to just package pycowsay into the pantry, so it could be installed like any other pip venv, a la https://github.com/pkgxdev/pantry/blob/main/projects/aws.amazon.com/cli/package.yml.

hmm, yeah, this is a few levels too deep of package managers. I will look at options without pipx. Thanks!