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

[REVIEW] pip does not copy subpackages #11

Closed
xwang862 opened this issue Mar 24, 2020 · 1 comment
Closed

[REVIEW] pip does not copy subpackages #11

xwang862 opened this issue Mar 24, 2020 · 1 comment

Comments

@xwang862
Copy link

Hi @hema-ted, I am naively following the recommended installation method. After I successfully installed pyzfs with pip install ., I encountered the following error when I tried to run the program:

% pyzfs --wfcfmt qbox --filename /Users/xwang/Programs/pyzfs/pyzfs/examples/o2_qbox_xml/o2.xml
Traceback (most recent call last):
  File "/Users/xwang/anaconda3/bin/pyzfs", line 5, in <module>
    from pyzfs.run import main
  File "/Users/xwang/anaconda3/lib/python3.6/site-packages/pyzfs/run.py", line 8, in <module>
    from .common.misc import parse_sys_argv
ModuleNotFoundError: No module named 'pyzfs.common'

From what I know, pip install . copies your local packages to site-packages and install from there. But it only copies those folders that are explicitly specified in the packages argument of setup(). Since packages=["pyzfs"], the subpackages of pyzfs were not copied.

Of course one can avoid my mistake by add the pyzfs source folder to PYTHONPATH. Or, you can save this step by either:

  • change your packages to include explicitly the subpackages like pyzfs.common, pyzfs.common.wfc, etc., or
  • use packages=find_packages() in setup(). This will automatically include all folders that contain the __init__.py file. And this will be especially useful if your program becomes large.
@hema-ted
Copy link
Owner

Hi @xwang862,

Thanks for your comment. In commit 8914384 I used find_packages in setup.py, as you suggested. Now it seems like the code will work by directly executing "pip install ."

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

2 participants