yingjerkao / uni10

Official Repo for Uni10
28 stars 9 forks source link

setup-python #17

Closed rezah closed 8 years ago

rezah commented 8 years ago

python paths: -- - Python Excutable : /usr/bin/python -- - Python Headers : /usr/local/include/python2.7 -- - Python Library : /usr/local/lib/libpython2.7.so -- - Swig Version : 3.0.10 -- - Swig Directory : /usr/share/swig/3.0.10

sudo setup.py install: running install running build running build_py copying init.py -> build/lib/pyUni10 copying pyUni10.py -> build/lib/pyUni10 copying _pyUni10.so -> build/lib/pyUni10 running install_lib copying build/lib/pyUni10/init.py -> /usr/local/lib/python2.7/site-packages/pyUni10 copying build/lib/pyUni10/pyUni10.py -> /usr/local/lib/python2.7/site-packages/pyUni10 copying build/lib/pyUni10/_pyUni10.so -> /usr/local/lib/python2.7/site-packages/pyUni10 byte-compiling /usr/local/lib/python2.7/site-packages/pyUni10/init.py to init.pyc byte-compiling /usr/local/lib/python2.7/site-packages/pyUni10/pyUni10.py to pyUni10.pyc running install_egg_info Removing /usr/local/lib/python2.7/site-packages/pyUni10-1.0.0-py2.7.egg-info Writing /usr/local/lib/python2.7/site-packages/pyUni10-1.0.0-py2.7.egg-info

When I run a test file called iTEBD.py, I get the following: Traceback (most recent call last): File "iTEBD.py", line 1, in import pyUni10 as uni10 File "/usr/local/lib/python2.7/site-packages/pyUni10/init.py", line 1, in from .pyUni10 import * File "/usr/local/lib/python2.7/site-packages/pyUni10/pyUni10.py", line 21, in _pyUni10 = swig_import_helper() File "/usr/local/lib/python2.7/site-packages/pyUni10/pyUni10.py", line 20, in swig_import_helper return importlib.import_module('_pyUni10') File "/usr/local/lib/python2.7/importlib/init.py", line 37, in import_module import(name) ImportError: No module named _pyUni10

I'm wondering what is wrong?

yingjerkao commented 8 years ago

Are you running the code under your pyUni10 directory? If so, move to another directory so that python will use the module you just installed.

rezah commented 8 years ago

No, I'm not. I don't understand what goes wrong....

rezah commented 8 years ago

It might be a confusion between different versions of python I have on my system....

You could close the issue.....

thanks....

yingjerkao commented 8 years ago

Yes, that can cause confusions. That's why we recommend anaconda python. Or you need to create a virtual environment.

xichuang commented 7 years ago

I use anaconda3-4.3.0 on Ubuntu 16.04 and create a python2 virtual environment.

here is my build configuration


-- Uni10: The Universal Tensor Network Library


-- -- Version: 1.0.0 -- Generator: Unix Makefiles -- Build Target: Linux-x86_64 -- Installation Prefix: /home/xich/local/uni10 -- CXX Compiler: /usr/bin/c++ -- CXX Flags: -fPIC -std=c++11 -- BLAS and LAPACK Libraries: /home/xich/anaconda3/lib/liblapack.so;/home/xich/anaconda3/lib/libblas.so -- Build APPACK Support: YES -- - ARPACK Libraries: /home/xich/anaconda3/lib/libarpack.so -- Build HDF5 Support: NO -- Build Examples: YES -- Build Python Wrapper: YES -- - Python Excutable : /home/xich/anaconda3/envs/py2/bin/python -- - Python Headers : /home/xich/anaconda3/envs/py2/include/python2.7 -- - Python Library : /home/xich/anaconda3/envs/py2/lib/libpython2.7.so -- - Swig Version : 3.0.10 -- - Swig Directory : /home/xich/anaconda3/share/swig/3.0.10 -- Build CUDA Support: NO -- Build Documentation: NO

I build and install correctly uni10 library without any error. But when I run python egB1.py, I got

(py2) xich@xich:python$ python egB1.py Traceback (most recent call last): File "egB1.py", line 2, in import pyUni10 as uni10 File "/home/xich/anaconda3/envs/py2/lib/python2.7/site-packages/pyUni10/init.py", line 1, in from .pyUni10 import * File "/home/xich/anaconda3/envs/py2/lib/python2.7/site-packages/pyUni10/pyUni10.py", line 21, in _pyUni10 = swig_import_helper() File "/home/xich/anaconda3/envs/py2/lib/python2.7/site-packages/pyUni10/pyUni10.py", line 20, in swig_import_helper return importlib.import_module('_pyUni10') File "/home/xich/anaconda3/envs/py2/lib/python2.7/importlib/init.py", line 37, in import_module import(name) ImportError: No module named _pyUni10 (py2) xich@xich:python$

Any suggestions?