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

pip installation overwrites module directory #887

Open
mfdgroot opened this issue Jun 26, 2024 · 5 comments
Open

pip installation overwrites module directory #887

mfdgroot opened this issue Jun 26, 2024 · 5 comments

Comments

@mfdgroot
Copy link

There seems to be an error when installing openfermion with pip into a specific target dir.
When running
pip install -t target openfermion,
I get
WARNING: Target directory /xxx/target/openfermion already exists. Specify --upgrade to force replacement..
This happens toward the end of the installation process.
This is what's in the dir without running with --upgrade and getting the warning:

$ls target/openfermion
chem      _compat.py       config.py    contrib      hamiltonians  linalg        ops          py.typed            testing     utils
circuits  _compat_test.py  conftest.py  functionals  __init__.py   measurements  __pycache__  resource_estimates  transforms  _version.py

And this is after running with --upgrade and without warning:

$ls target/openfermion
docs

So all of the module files are also gone.

@fdmalone
Copy link
Collaborator

This looks like a common problem with pip: pypa/pip#8063 that hasn't been resolved. @pavoljuhas have you encountered anything like this before?

@forget-the-bright
Copy link

forget-the-bright commented Jul 16, 2024

已经被这个折磨一天了,最终选择折中的方法 ,使用pipx
我在下面记录我自己探索解决方法的过程
[Having been tortured by this all day, I finally chose the compromise and used pipx
Below I document my own search for a solution]
https://memos.haowuan.top/m/gUAJKSzdjEjJZk3grRWL8C

@fdmalone
Copy link
Collaborator

going to close this an issue with pip, feel free to reopen if there's another solution.

@pavoljuhas
Copy link
Contributor

This looks like a common problem with pip: pypa/pip#8063 that hasn't been resolved. @pavoljuhas have you encountered anything like this before?

This seems to happen because openfermion declares documentation files as data_files and as such they would install under PREFIX/openfermion. The package sources go to PREFIX/lib/pythonX.Y/site-packages/openfermion. The --target=TARGET option makes pip install both the docs and sources to TARGET/openfermion and it seems only the documentation files survive.

I can think of two remedies

(1) use pip install --prefix=/path/to/prefix instead of --target=TARGET so that the openfermion directories for docs and package sources are different

OR

(2) update openfermion/setup.py to have documentation files included as package_data so they get installed somewhere under .../site-packages/openfermion instead of to PREFIX/openfermion.

@fdmalone fdmalone reopened this Jul 16, 2024
@fdmalone
Copy link
Collaborator

thanks @pavoljuhas I think 2 is probably best.

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

No branches or pull requests

4 participants