Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing proposal in conda not working on ubuntu? #381

Open
Jean1995 opened this issue Nov 10, 2023 · 12 comments
Open

Importing proposal in conda not working on ubuntu? #381

Jean1995 opened this issue Nov 10, 2023 · 12 comments

Comments

@Jean1995
Copy link
Member

Jean1995 commented Nov 10, 2023

When trying to import proposal after installing it with pip install proposal from inside the environment, and then try to import it, I get the error message:


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: libpython3.9.so.1.0: cannot open shared object file: No such file or directory

I don't know there this is coming from.

@Jean1995
Copy link
Member Author

Possibly related to #327?

@maxnoe
Copy link
Member

maxnoe commented Nov 10, 2023

@Jean1995 Seems to be identical to #327 (you are both using conda on ubuntu)

@Jean1995
Copy link
Member Author

Yes, creating a new conda environment and installing proposal there fixed it. But this shouldn't be the default solution in my opinion, something must still be going wrong...

@maxnoe
Copy link
Member

maxnoe commented Nov 10, 2023

I just tried it with a fresh environment using python 3.11 and I get the same error:

mamba create -n proposal python=3.11 pip  
mamba activate proposal
pip install -vv proposal   
python -c 'import proposal'      
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: libpython3.11.so.1.0: cannot open shared object file: No such file or directory

@maxnoe
Copy link
Member

maxnoe commented Nov 10, 2023

It works when building proposal using the conda compilers and not sthe system compilers, i.e. with this environment:

mamba create -n proposal-conda-compilers python=3.11 pip compilers

@Jean1995
Copy link
Member Author

In the setup.py, we set the python executable via

'-DPython_EXECUTABLE=' + sys.executable,

is this maybe not the correct way?

@maxnoe
Copy link
Member

maxnoe commented Nov 10, 2023

Looking into the build log file, it is using the correct python to compile, but then at runtime it doesn't find the corresponding library.

Note that the version of the library not being found is the one in the conda env, so the compilation step was correct.

I think the issue is wrong RPATH information.

@thomwg11
Copy link

I'm experiencing what I believe to be a similar issue on an M1 Mac running macOS and trying to pip install proposal in a conda environment, except in my case importing proposal results in a segmentation fault.

@Jean1995
Copy link
Member Author

I'm experiencing what I believe to be a similar issue on an M1 Mac running macOS and trying to pip install proposal in a conda environment, except in my case importing proposal results in a segmentation fault.

This sounds like the problem in issue #209, which might very well also be related to this problem.

@maxnoe
Copy link
Member

maxnoe commented Nov 10, 2023

I think this line might be at fault:

'-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=OFF',

The link path of the libpython should probably be used, at least in case of a conda installation.

@maxnoe
Copy link
Member

maxnoe commented Nov 10, 2023

Or adapt the lines here:

rpath = '@loader_path' if sys.platform == 'darwin' else '$ORIGIN'

to include the library, best as a relative path from the python module.

pyproposal will be installed to something like <prefix>/lib/site-packages/pythonxy/ so you could try to add $ORIGIN/../../../

@Jean1995
Copy link
Member Author

These lines were added in #80, more specifically in commit 75392b6. Apparently there were some issues with MacOS (as usual...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants