hema-ted / pyzfs

A python package to compute zero-field-splitting tensors for molecules and spin quantum bits in semiconductors.
MIT License
11 stars 10 forks source link

[REVIEW] pip does not copy subpackages #11

Closed xwang862 closed 4 years ago

xwang862 commented 4 years ago

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:

hema-ted commented 4 years ago

Hi @xwang862,

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