python-necpp
python-necpp copied to clipboard
ModuleNotFoundError: No module named 'PyNEC'
I am on RHEL7. The shared library buids successfully but when I try to do "from PyNEC import *" it produces the error: ModuleNotFoundError: No module named 'PyNEC'
My PYTHONPATH includes $HOME/.local/lib/python3.8/site-packages as confirmed by print(sys.path).
The contents of that directory is:
easy-install.pth PyNEC-1.7.3.6-py3.8-linux-x86_64.egg
There is no directory called PyNEC containing an init.py file.
Here are the contents of the one directory:
$ ls PyNEC-1.7.3.6-py3.8-linux-x86_64.egg/ EGG-INFO examples pycache _PyNEC.cpython-38-x86_64-linux-gnu.so _PyNEC.py
I have the same issue on MacOS Catalina 10.15.7. Python version is 3.9.1. It used to work last time I tried PyNEC in April 2020.
As a workaround the previous version can be installed:
pip3 install PyNEC==1.7.3.4
Something was broken between releases 1.7.3.4 (Aug 2019) and 1.7.3.6 (May 2020)
I have the same issue on MacOS 10.14.6:
$ pip freeze cycler==0.10.0 kiwisolver==1.3.1 matplotlib==3.4.1 necpp==1.7.3.5 numpy==1.20.2 Pillow==8.2.0 PyNEC==1.7.3.6 pyparsing==2.4.7 python-dateutil==2.8.1 scipy==1.6.2 six==1.15.0 $ python -V Python 3.9.4 $
Works after downgrade (but got an error "RuntimeError: SYMMETRY ERROR - NROW: 1929734915 NCOL: 1778416642" - might be my own fault [2021-may-08: Was my fault. PyNEC works in this environment]): $ pip freeze cycler==0.10.0 kiwisolver==1.3.1 matplotlib==3.4.1 necpp==1.7.3.5 numpy==1.20.2 Pillow==8.2.0 PyNEC==1.7.3.4 pyparsing==2.4.7 python-dateutil==2.8.1 scipy==1.6.3 six==1.15.0 $ python -V Python 3.9.4 $
@glenndk try requirements.txt from this project https://github.com/afiskon/pynec-examples Worked for me.
@afiskon Thanks for your comment. It was a fault in my test program. PyNEC==1.7.3.4 works in this environment:
$ pip freeze cycler==0.10.0 kiwisolver==1.3.1 matplotlib==3.4.1 necpp==1.7.3.5 numpy==1.20.2 Pillow==8.2.0 PyNEC==1.7.3.4 pyparsing==2.4.7 python-dateutil==2.8.1 scipy==1.6.3 six==1.15.0 $ python -V Python 3.9.4 $
Similar problem here. "No module named 'PyNEC'". :-(
$ pydoc3 modules
Please wait a moment while I gather a list of all available modules...
_PyNEC
>>> import _PyNEC
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define module export function (PyInit__PyNEC)
This is because (on my system at least) the name of the swig binary has changed from swig3.0
to just swig
- see build.sh
https://github.com/tmolteno/python-necpp/blob/master/PyNEC/build.sh#L17 .
If you look carefully at the output of the build process, swig isn't running at all. Making the above change fixed it for me.
@daniel-ayers Oh good catch. The module specified installing building with version 3, whereas swig is currently at version 4.
PR https://github.com/tmolteno/python-necpp/pull/26 generated.
I know this is off-topic, but is PyNEC still being actively developed? If so, is there somewhere that provides documentation of the pl_card
from the bottom of this page?
... is there somewhere that provides documentation of the
pl_card
...
PyNEC is a Python wrapper around a C++ library that implements a very old (c. 1980) input & output format. To understand the PL card refer to the documentation of the original library - see https://github.com/tmolteno/python-necpp/issues/22#issuecomment-1469618534 .
As a workaround the previous version can be installed:
pip3 install PyNEC==1.7.3.4
Something was broken between releases 1.7.3.4 (Aug 2019) and 1.7.3.6 (May 2020)
Solved the problem ...