Amber-MD / pytraj

Python interface of cpptraj
https://amber-md.github.io/pytraj
168 stars 38 forks source link

Installation issue #1104

Closed Balasubra closed 8 years ago

Balasubra commented 8 years ago

Hi, I am new to pytraj. I dnt know if there is any discussion forum available, so i am posting my issues here.

I cloned pytraj and cpptraj from github. I have been successful in compiling cpptraj without any error, following which i tried to install pytraj but i end up in the following error which i am not able to resolve. I would appreciate your help on this regard. I dnt understand whats going wrong, googlg didnot help me much.

python setup.py build --disable-openmp /home/cbala/pytraj/pytraj/cyutils.cpp:25009: undefined reference to PyInt_Type' /home/cbala/pytraj/pytraj/cyutils.cpp:25016: undefined reference toPyLong_Type' /home/cbala/pytraj/pytraj/cyutils.cpp:25059: undefined reference to PyLong_AsSsize_t' /home/cbala/pytraj/pytraj/cyutils.cpp:25061: undefined reference toPyNumber_Index' /home/cbala/pytraj/pytraj/cyutils.cpp:25063: undefined reference to PyInt_AsSsize_t' build/temp.linux-x86_64-2.7/pytraj/cyutils.o: In function__Pyx_PyInt_FromSize_t': /home/cbala/pytraj/pytraj/cyutils.cpp:25068: undefined reference to `PyInt_FromSize_t' collect2: error: ld returned 1 exit status error: command 'c++' failed with exit status 1

swails commented 8 years ago

What version of Python are you using?

Balasubra commented 8 years ago

python 2.7.6

swails commented 8 years ago

Some googling suggests that this might be a 32-bit vs. 64-bit issue. What is the output of the command filewhich python``?

Balasubra commented 8 years ago

/usr/bin/python

On 13 January 2016 at 18:20, Jason Swails notifications@github.com wrote:

Some googling suggests that this might be a 32-bit vs. 64-bit issue. What is the output of the command file which python?

— Reply to this email directly or view it on GitHub https://github.com/Amber-MD/pytraj/issues/1104#issuecomment-171369501.

swails commented 8 years ago

I meant something more along the lines of:

$ file `which python`
/usr/bin/python: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
Balasubra commented 8 years ago

It comes like this

cbala@Galileo ~/pytraj $ file which python

/usr/bin/python: symbolic link to `python2.7'

On 13 January 2016 at 18:33, Jason Swails notifications@github.com wrote:

I meant something more along the lines of:

$ file which python /usr/bin/python: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

— Reply to this email directly or view it on GitHub https://github.com/Amber-MD/pytraj/issues/1104#issuecomment-171373372.

swails commented 8 years ago

Haha... ok. What about

$ file /usr/bin/python2.7

?

Balasubra commented 8 years ago

/usr/bin/python2.7: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=502c59409208bd0bf5acfa9c497107ec487e3bd6, stripped

On 13 January 2016 at 18:38, Jason Swails notifications@github.com wrote:

Haha... ok. What about

$ file /usr/bin/python2.7

?

— Reply to this email directly or view it on GitHub https://github.com/Amber-MD/pytraj/issues/1104#issuecomment-171374732.

swails commented 8 years ago

OK, so there goes my idea. Not a 64-vs-32 bit issue. What OS are you using?

Balasubra commented 8 years ago

linux mint 17.3 xfce desktop version

hainm commented 8 years ago

I myself don't know why this happens. While waiting for solution from @swails or others, can you try python version from Miniconda?

wget http://repo.continuum.io/miniconda/Miniconda-3.7.0-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b
conda install  -c ambermd pytraj-dev

All should take 1.5 minutes.

PS: if you want to install pytraj, you don't need to manually install cpptraj, pytraj will do this. python setup.py install is sufficient.

Let me know if Miniconda is magic.

Hai

Balasubra commented 8 years ago

I will try miniconda

Infact i tried first by simply running python setup install, i got the same error, then i tried by compiling cpptraj myself and then tried to build pyptraj.

the output of "python setup.py install" is below. The problem arises with cyutil

creating build/lib.linux-x86_64-2.7/pytraj/datafiles/dpdp copying pytraj/datafiles/dpdp/init.py -> build/lib.linux-x86_64-2.7/pytraj/datafiles/dpdp creating build/lib.linux-x86_64-2.7/pytraj/datafiles/trpcage copying pytraj/datafiles/trpcage/init.py -> build/lib.linux-x86_64-2.7/pytraj/datafiles/trpcage creating build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/simple_plot.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/init.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/wrap_seaborn.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/symbols.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/plot_phipsi.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/font_config.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/base.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/plot_matrix.py -> build/lib.linux-x86_64-2.7/pytraj/plot creating build/lib.linux-x86_64-2.7/pytraj/math copying pytraj/math/init.py -> build/lib.linux-x86_64-2.7/pytraj/math creating build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/init.py -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/elements.py -> build/lib.linux-x86_64-2.7/pytraj/core creating build/lib.linux-x86_64-2.7/pytraj/parallel copying pytraj/parallel/mpi.py -> build/lib.linux-x86_64-2.7/pytraj/parallel copying pytraj/parallel/init.py -> build/lib.linux-x8664-2.7/pytraj/parallel copying pytraj/parallel/multiprocessing.py -> build/lib.linux-x86_64-2.7/pytraj/parallel creating build/lib.linux-x86_64-2.7/pytraj/cluster copying pytraj/cluster/init.py -> build/lib.linux-x86_64-2.7/pytraj/cluster creating build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/sandbox/init.py -> build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/sandbox/TrajectoryBaseIterator.py -> build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/sandbox/qm.py -> build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/sandbox/lazy.py -> build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/sandbox/transform.py -> build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/cpp_vector.pxd -> build/lib.linux-x86_64-2.7/pytraj copying pytraj/cpp_algorithm.pxd -> build/lib.linux-x86_64-2.7/pytraj copying pytraj/frame.pxd -> build/lib.linux-x86_64-2.7/pytraj copying pytraj/c_dict.pxd -> build/lib.linux-x86_64-2.7/pytraj copying pytraj/topology.pxd -> build/lib.linux-x86_64-2.7/pytraj copying pytraj/core/cpp_vector.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/box.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/topology_objects.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/coordinfo.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/c_core.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/parameter_types.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/c_traj/c_trajectory.pxd -> build/lib.linux-x86_64-2.7/pytraj/c_traj copying pytraj/c_traj/c_trajout.pxd -> build/lib.linux-x86_64-2.7/pytraj/c_traj copying pytraj/c_analysis/c_analysis.pxd -> build/lib.linux-x86_64-2.7/pytraj/c_analysis copying pytraj/datafiles/datafiles.pxd -> build/lib.linux-x86_64-2.7/pytraj/datafiles copying pytraj/math/cpp_math.pxd -> build/lib.linux-x86_64-2.7/pytraj/math copying pytraj/datasets/c_datasets.pxd -> build/lib.linux-x86_64-2.7/pytraj/datasets copying pytraj/datasets/c_datasetlist.pxd -> build/lib.linux-x86_64-2.7/pytraj/datasets copying pytraj/c_action/actionlist.pxd -> build/lib.linux-x86_64-2.7/pytraj/c_action copying pytraj/c_action/c_action.pxd -> build/lib.linux-x86_64-2.7/pytraj/c_action copying pytraj/datafiles/ala3/Ala3.top -> build/lib.linux-x86_64-2.7/pytraj/datafiles/ala3 copying pytraj/datafiles/ala3/Ala3.crd -> build/lib.linux-x86_64-2.7/pytraj/datafiles/ala3 copying pytraj/datafiles/tz2/tz2.parm7 -> build/lib.linux-x86_64-2.7/pytraj/datafiles/tz2 copying pytraj/datafiles/tz2/tz2.ortho.parm7 -> build/lib.linux-x86_64-2.7/pytraj/datafiles/tz2 copying pytraj/datafiles/tz2/tz2.nc -> build/lib.linux-x86_64-2.7/pytraj/datafiles/tz2 copying pytraj/datafiles/tz2/tz2.ortho.nc -> build/lib.linux-x86_64-2.7/pytraj/datafiles/tz2 copying pytraj/datafiles/rna.pdb -> build/lib.linux-x86_64-2.7/pytraj/datafiles copying pytraj/datafiles/trpcage/trpcage.pdb.gz -> build/lib.linux-x86_64-2.7/pytraj/datafiles/trpcage copying pytraj/datafiles/dpdp/DPDP.nc -> build/lib.linux-x86_64-2.7/pytraj/datafiles/dpdp copying pytraj/datafiles/dpdp/DPDP.parm7 -> build/lib.linux-x86_64-2.7/pytraj/datafiles/dpdp running build_ext skipping 'pytraj/cyutils.cpp' Cython extension (up-to-date) building 'pytraj.cyutils' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/pytraj x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/cbala/pytraj/cpptraj/src/ -I/home/cbala/pytraj/pytraj/ -I/usr/include/python2.7 -c pytraj/cyutils.cpp -o build/temp.linux-x86_64-2.7/pytraj/cyutils.o -O0 -ggdb -Wl,--no-undefined -fopenmp

On 13 January 2016 at 18:57, Hai Nguyen notifications@github.com wrote:

I myself don't know why this happen. While waiting for solution from @swails https://github.com/swails or others, can you try python version from Miniconda?

  • install python by miniconda

wget http://repo.continuum.io/miniconda/Miniconda-3.7.0-Linux-x86_64.sh -O miniconda.sh bash miniconda.sh -b

  • then install pytraj

conda update -c ambermd pytraj-dev

All should take 1.5 minutes.

PS: if you want to install pytraj, you don't need to manually install cpptraj, pytraj will do this. python setup.py install is sufficient.

Let me know if Miniconda is magic.

Hai

— Reply to this email directly or view it on GitHub https://github.com/Amber-MD/pytraj/issues/1104#issuecomment-171379850.

Balasubra commented 8 years ago

I HAVE NOW INSTALLED pytraj

The compilation stopped giving the following error (which i reported yesterday)

/home/cbala/pytraj/pytraj/cyutils.cpp:25009: undefined reference to PyInt_Type' /home/cbala/pytraj/pytraj/cyutils.cpp:25016: undefined reference to PyLong_Type' /home/cbala/pytraj/pytraj/cyutils.cpp:25059: undefined reference to PyLong_AsSsize_t' /home/cbala/pytraj/pytraj/cyutils.cpp:25061: undefined reference to PyNumber_Index' /home/cbala/pytraj/pytraj/cyutils.cpp:25063: undefined reference to PyInt_AsSsize_t' build/temp.linux-x86_64-2.7/pytraj/cyutils.o: In function __Pyx_PyInt_FromSize_t': /home/cbala/pytraj/pytraj/cyutils.cpp:25068: undefined reference to `PyInt_FromSize_t

I opened setup.py and changed the following lines

extra_compile_args = ['-O0', '-ggdb', '-Wl,--no-undefined']

extra_link_args = ['-O0', '-ggdb', '-Wl,--no-undefined']

as follows, i simply deleted the extra options

extra_compile_args = ['-O0', '-ggdb'] extra_link_args = ['-O0', '-ggdb']

However i dnt know the problem of installing pytraj by switching off this argument '-Wl,--no-undefined'. Please enlighten me. I am able to import pytraj now successfully.

On 13 January 2016 at 19:10, Balasubramanian Chandramouli < bala.chandramouli@sns.it> wrote:

I will try miniconda

Infact i tried first by simply running python setup install, i got the same error, then i tried by compiling cpptraj myself and then tried to build pyptraj.

the output of "python setup.py install" is below. The problem arises with cyutil

creating build/lib.linux-x86_64-2.7/pytraj/datafiles/dpdp copying pytraj/datafiles/dpdp/init.py -> build/lib.linux-x86_64-2.7/pytraj/datafiles/dpdp creating build/lib.linux-x86_64-2.7/pytraj/datafiles/trpcage copying pytraj/datafiles/trpcage/init.py -> build/lib.linux-x86_64-2.7/pytraj/datafiles/trpcage creating build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/simple_plot.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/init.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/wrap_seaborn.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/symbols.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/plot_phipsi.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/font_config.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/base.py -> build/lib.linux-x86_64-2.7/pytraj/plot copying pytraj/plot/plot_matrix.py -> build/lib.linux-x86_64-2.7/pytraj/plot creating build/lib.linux-x86_64-2.7/pytraj/math copying pytraj/math/init.py -> build/lib.linux-x86_64-2.7/pytraj/math creating build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/init.py -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/elements.py -> build/lib.linux-x86_64-2.7/pytraj/core creating build/lib.linux-x86_64-2.7/pytraj/parallel copying pytraj/parallel/mpi.py -> build/lib.linux-x86_64-2.7/pytraj/parallel copying pytraj/parallel/init.py -> build/lib.linux-x8664-2.7/pytraj/parallel copying pytraj/parallel/multiprocessing.py -> build/lib.linux-x86_64-2.7/pytraj/parallel creating build/lib.linux-x86_64-2.7/pytraj/cluster copying pytraj/cluster/init.py -> build/lib.linux-x86_64-2.7/pytraj/cluster creating build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/sandbox/init.py -> build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/sandbox/TrajectoryBaseIterator.py -> build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/sandbox/qm.py -> build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/sandbox/lazy.py -> build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/sandbox/transform.py -> build/lib.linux-x86_64-2.7/pytraj/sandbox copying pytraj/cpp_vector.pxd -> build/lib.linux-x86_64-2.7/pytraj copying pytraj/cpp_algorithm.pxd -> build/lib.linux-x86_64-2.7/pytraj copying pytraj/frame.pxd -> build/lib.linux-x86_64-2.7/pytraj copying pytraj/c_dict.pxd -> build/lib.linux-x86_64-2.7/pytraj copying pytraj/topology.pxd -> build/lib.linux-x86_64-2.7/pytraj copying pytraj/core/cpp_vector.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/box.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/topology_objects.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/coordinfo.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/c_core.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/core/parameter_types.pxd -> build/lib.linux-x86_64-2.7/pytraj/core copying pytraj/c_traj/c_trajectory.pxd -> build/lib.linux-x86_64-2.7/pytraj/c_traj copying pytraj/c_traj/c_trajout.pxd -> build/lib.linux-x86_64-2.7/pytraj/c_traj copying pytraj/c_analysis/c_analysis.pxd -> build/lib.linux-x86_64-2.7/pytraj/c_analysis copying pytraj/datafiles/datafiles.pxd -> build/lib.linux-x86_64-2.7/pytraj/datafiles copying pytraj/math/cpp_math.pxd -> build/lib.linux-x86_64-2.7/pytraj/math copying pytraj/datasets/c_datasets.pxd -> build/lib.linux-x86_64-2.7/pytraj/datasets copying pytraj/datasets/c_datasetlist.pxd -> build/lib.linux-x86_64-2.7/pytraj/datasets copying pytraj/c_action/actionlist.pxd -> build/lib.linux-x86_64-2.7/pytraj/c_action copying pytraj/c_action/c_action.pxd -> build/lib.linux-x86_64-2.7/pytraj/c_action copying pytraj/datafiles/ala3/Ala3.top -> build/lib.linux-x86_64-2.7/pytraj/datafiles/ala3 copying pytraj/datafiles/ala3/Ala3.crd -> build/lib.linux-x86_64-2.7/pytraj/datafiles/ala3 copying pytraj/datafiles/tz2/tz2.parm7 -> build/lib.linux-x86_64-2.7/pytraj/datafiles/tz2 copying pytraj/datafiles/tz2/tz2.ortho.parm7 -> build/lib.linux-x86_64-2.7/pytraj/datafiles/tz2 copying pytraj/datafiles/tz2/tz2.nc -> build/lib.linux-x86_64-2.7/pytraj/datafiles/tz2 copying pytraj/datafiles/tz2/tz2.ortho.nc -> build/lib.linux-x86_64-2.7/pytraj/datafiles/tz2 copying pytraj/datafiles/rna.pdb -> build/lib.linux-x86_64-2.7/pytraj/datafiles copying pytraj/datafiles/trpcage/trpcage.pdb.gz -> build/lib.linux-x86_64-2.7/pytraj/datafiles/trpcage copying pytraj/datafiles/dpdp/DPDP.nc -> build/lib.linux-x86_64-2.7/pytraj/datafiles/dpdp copying pytraj/datafiles/dpdp/DPDP.parm7 -> build/lib.linux-x86_64-2.7/pytraj/datafiles/dpdp running build_ext skipping 'pytraj/cyutils.cpp' Cython extension (up-to-date) building 'pytraj.cyutils' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/pytraj x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/cbala/pytraj/cpptraj/src/ -I/home/cbala/pytraj/pytraj/ -I/usr/include/python2.7 -c pytraj/cyutils.cpp -o build/temp.linux-x86_64-2.7/pytraj/cyutils.o -O0 -ggdb -Wl,--no-undefined -fopenmp

On 13 January 2016 at 18:57, Hai Nguyen notifications@github.com wrote:

I myself don't know why this happen. While waiting for solution from @swails https://github.com/swails or others, can you try python version from Miniconda?

  • install python by miniconda

wget http://repo.continuum.io/miniconda/Miniconda-3.7.0-Linux-x86_64.sh -O miniconda.sh bash miniconda.sh -b

  • then install pytraj

conda update -c ambermd pytraj-dev

All should take 1.5 minutes.

PS: if you want to install pytraj, you don't need to manually install cpptraj, pytraj will do this. python setup.py install is sufficient.

Let me know if Miniconda is magic.

Hai

— Reply to this email directly or view it on GitHub https://github.com/Amber-MD/pytraj/issues/1104#issuecomment-171379850.

hainm commented 8 years ago

@Balasubra great that you can install pytraj now.

But I am not sure I understand your question. Do you mean that to able to install pytraj, you need to delete -Wl,--no-undefined flag?

(FYI: we recently added -Wl,--no-undefined to catch the undefined symbol in libcpptraj, but it's fine to delete it in most cases)

Were you able to install pytraj with Miniconda installation?

Balasubra commented 8 years ago

a) Yes i deleted the -Wl,--no-undefined flag from setup.py and then i was able to install pytraj. Now i have to do some testing to see if everything is okay

b) I have not tried installing pytraj with Miniconda but i would give try.

On 14 January 2016 at 19:06, Hai Nguyen notifications@github.com wrote:

@Balasubra https://github.com/Balasubra great that you can install pytraj now.

But I am not sure I understand your question. Do you mean that to able to install pytraj, you need to delete -Wl,--no-undefined flag?

(FYI: we recently add -Wl,--no-undefined to catch the undefined symbol in libcpptraj https://github.com/Amber-MD/cpptraj/pull/222, but it's fine to delete it in most cases)

Were you able to install pytraj with Miniconda installation?

— Reply to this email directly or view it on GitHub https://github.com/Amber-MD/pytraj/issues/1104#issuecomment-171724965.

hainm commented 8 years ago

great. If removing above flag works for you, I probally will remove from setup.py too. FYI: you can try this to test: http://amber-md.github.io/pytraj/latest/trajectory_exercise.html

or go to pytraj folder: python runtests.py

Let us know if you still get any issue. thanks for trying.

Balasubra commented 8 years ago

I was lucky, all tests were passed.

On 15 January 2016 at 09:42, Hai Nguyen notifications@github.com wrote:

great. If removing above flag works for you, I probally will remove from setup.py too. FYI: you can try this to test: http://amber-md.github.io/pytraj/latest/trajectory_exercise.html

or go to pytraj folder: python runtests.py

Let us know if you still get any issue. thanks for trying.

— Reply to this email directly or view it on GitHub https://github.com/Amber-MD/pytraj/issues/1104#issuecomment-171903000.

hainm commented 8 years ago

Great. Feel free to open new issue if you have other Q.