PHCpack icon indicating copy to clipboard operation
PHCpack copied to clipboard

Everything looks ok but I get ModuleNotFoundError: No module named 'phcpy'

Open felipebottega opened this issue 7 years ago • 5 comments

Hello,

I already have installed python 3.6.1, through Anaconda 4.4.0. To get phcpy, I followed the instructions in http://homepages.math.uic.edu/~jan/phcpy_doc_html/welcome.html#installing-phcpy without mistake. In step 6 I did as said and the command phcpy2c3.so runs without any errors. I run Python in the directory Python/PHCpy3/phcpy, the file phcpy2c3.so is there but I still get ModuleNotFoundError: No module named 'phcpy' when trying to use import phcpy in Python.

I really don't understand what is going on. Is there something I could try to fix this?

felipebottega avatar Sep 04 '17 22:09 felipebottega

PS: To be honest, I didn't try to edit .bashrc or .cshrc. This is the only part I skipped from the instructions. the reason is because I just don't know how to edit these. Thank you for your attention.

felipebottega avatar Sep 04 '17 22:09 felipebottega

Step 6 should work if the Python interpreter starts looking in the current directory when a module is imported. To fix this, you could insert the current directory to the module path in Python.

janverschelde avatar Sep 05 '17 19:09 janverschelde

I used the commands import sys sys.path.append('/home/integral/Documents/PHCv2_4p/PHCv2_4p/Python/PHCpy3/phcpy')

After that, I am able to to type (for example) import solver or import diagonal without errors. But import phcpy still not working. I tried to work directly with the solver module but it doesn't work, probably because it depends on the phcpy module. In the directory there is no file phcpy.py, is this expected? The file phcpy2c3.so is supposed to be the module phcpy?

felipebottega avatar Sep 06 '17 03:09 felipebottega

Ok, I think I detected where is the problem. The gna-ada compiler is not in front of the execution path. The command gcc -v gives me the following.

Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)

The expected output should be for GNAT GPL but there is no trace of this above. What exactly can I do to fix this? I know Python but I'm inexperienced with terminal commands (I don't even know what is bashrc or cshrc). Thank you for your attention.

felipebottega avatar Sep 06 '17 18:09 felipebottega

To place the gnu-ada compiler in front of your path, edit the .bashrc (observe the dot . in front of the bashrc) in your home directory. If the gnu-ada compiler is installed in /usr/local/gnat, then add the statement PATH=/usr/local/gnat/bin:$PATH; export PATH somewhere in your .bashrc file. To see the effect of this statement, you can either logout and login again, or do source ~/.bashrc.

janverschelde avatar Sep 09 '17 20:09 janverschelde