Closed leejayyoon closed 6 years ago
hmm. It seems that I have come across the same problem before. What I did was:
Then try to
python -c 'import dynet;print dynet.__file__'
@leejayyoon you are building /home/jisuk1/tools/dynet-base2/dynet
but your LD_LIBRARY_PATH
contains a different path, /home/jisuk1/tools/dynet-base/dynet
, where you probably have an old version compiled.
@danielhers Sorry for the confusion. It was simple error from copying paste from the open issue I made 20 days ago on #649, but I was trying this installation like 7 times and I changed the path accordingly. I am going to go ahead and modify original opening, as it might confuse others. Thanks for the comment.
But, what is the right way to clean all the dynet related materials to be sure? I just deleted under my ~/.local/lib and dynet git folder. (although I think 'rm -rf build' is fine)
@chunyang-wen I did that, and it still spits out -->
File "<string>", line 1, in <module>
File "dynet.py", line 15, in <module>
from _dynet import *
ImportError: ./_dynet.so: undefined symbol: _ZN5dynet13TextFileSaver4saveERKNS_19ParameterCollectionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
When you see the directions on the python installation, it seems to indicate, at least in the dynet-base/dynet/build/python should be working regardless of the path or library issues, and that error I posted comes out from the python folder inside build folder.
I copy, pasted relevant part from http://dynet.readthedocs.io/en/latest/python.html. You now have a working Python binding inside of build/dynet. To verify this is working:
cd $PATH_TO_DYNET/build/python
python
then, within Python:
import dynet as dy
print dy.__version__
pc = dy.ParameterCollection()
cmake log:
-- The C compiler identification is GNU 4.8.4 -- The CXX compiler identification is GNU 4.8.4
Python installation log:
g++ (GCC) 5.4.0
You are using two different compilers?
@chunyang-wen Nice catch! This seems to be the problem.
@chunyang-wen It finally works!! Thanks for catching that. I can't believe that I missed this as I was specifically looking for python gcc version mismatch ... but I guess I was only looking it on the python side. Thinking back, I should have checked the gcc on Cmake after recognizing that I cannot import dynet inside build/python folder... Thanks again.
Side note: Also it seems to be working without modification to PATH, LD_LIBRARY_PATH, DYLD_LIBRARY_PATH as @chunyang-wen has mentioned.
Hi,
It seems my installation process finishes without problem, nonetheless, the simple import is spitting errors. I tested just installing c++ as well (cmake without -DPYTHON=
which python
). Both cases, generated c++ examples seem to be running Okay, and thus I am suspecting somewhere in the library linking process is not working properly, but I am not too sure where ... I also didn't have problem with other server following similar procedures. The other one was Red Hat Linux, and it had lib, bins in more standard place: /usr/local/ .. whereas this computer has common things on /share/apps/. On last note, I don't have sudo and I made everything local. (This might be related to other open issues: #649 and #685 )So to jump to the symptom, I am getting error when, I do,
python -c "import dynet"
This is the error log:After describing the environment and configurations I made, at the end, I am putting the logs from make as well.
Environment: I am running on ubuntu 14.04, on GPU server with cudnn-5.1.5, cuda-8.0, gcc version 5.4.0
What I did I ran the following:
cmake .. -DEIGEN3_INCLUDE_DIR=../../eigen -DPYTHON=
which python-DBACKEND=cuda -DCUDNN_ROOT=/share/apps/cuda-8.0
and the rest is the same with the tutorial, i.e.,My cudnn is on non-conventional location, so I specified the cudnn root. I tried multiple installation, which got all the same errors when importing, and this was the final form. While re-installing as I wanted to overcome the error,
PATH, LD_LIBRARY_PATH
On top of including the library file on the path, I also tried to include $PREFIX/.local/bin on PATH $PREFIX/.local/lib on LD_LIBRARY_PATH as I did 'local install'. I also tried putting dynet library path to the front ... but it didn't work regardless.
export PYTHONPATH=$PREFIX/tools/dynet-base2/dynet/build/python:$PYTHONPATH
following @pmichel31415 's instruction.This is on my .bashrc:
Here are the specified logs that I had during cmake, make, and python installation. cmake log
Make log
Python installation log