CGATOxford / cgat

Do not use - please refer to our newest code: https://github.com/cgat-developers/cgat-apps
BSD 3-Clause "New" or "Revised" License
124 stars 66 forks source link

How do I get bed2psl.py to run, in a conda (--devel) installation of CGAT? #392

Closed SchwarzEM closed 6 years ago

SchwarzEM commented 6 years ago

I've followed the advice in #388 in order to install a version of CGAT that contains bed2psl.py.

curl -O https://raw.githubusercontent.com/CGATOxford/cgat/master/install-CGAT-tools.sh ;

mkdir $HOME/src/cgat ;

bash install-CGAT-tools.sh --devel --location $HOME/src/cgat ;

[...] [... long installation process that eventually reaches this message ...] [...] The code was successfully installed!

After that, I activate CGAT, as instructed during the installation process:

source $HOME/src/cgat/conda-install/bin/activate cgat-s ;

The CGAT installation appears to have bed2psl as one of its components:

cgat --help all ;

[... many tools ...] bed2psl [... etc. ..]

But then, when I try to run bed2psl in various ways, I get the following messages:

cgat bed2psl ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bed2psl --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

bed2psl ;

-bash: bed2psl: command not found

bed2psl --help ;

-bash: bed2psl: command not found

So, is there something I'm supposed to be doing, and which I'm not doing, that would make it possible to run bed2psl? If so, what is it?

Conversely, if there's something I've done wrong in my installation that would have the effect of crippling bed2psl, how can I redo my CGAT installation better?

Acribbs commented 6 years ago

As a sanity check, would you be able to run which python and echo $PYTHONPATH to make sure that your python path isn't pointing to another version of python.

The issue isn't clear to me at the moment and I have no issues running bed2psl, but if its related to your installation process @sebastian-luna-valero is the best person to answer this one.

SchwarzEM commented 6 years ago

Thanks for the suggestions. Here's what I get on my system, after running the following commands:

cd $HOME/src/cgat ;
source $HOME/src/cgat/conda-install/bin/activate cgat-s ;

[the (cgat-s) environment appears]

which python ;

~/src/cgat/conda-install/envs/cgat-s/bin/python

# check the version
python --version ;

Python 3.6.3

# now check this:
echo $PYTHONPATH ;

[whoops! nothing at all shows up!]

So, it looks as if I may need to be supplying $PYTHONPATH to my shell. What would a good value for it be?

Acribbs commented 6 years ago

Ah your PYTHONPATH is required for modules to be available within python. I wonder if this is the issue.

if you try source $HOME/src/cgat/conda-install/bin/activate cgat-s unset PYTHONPATH export PYTHONPATH=$HOME/src/cgat/cgat-scripts

Then try cgat bed2psl --help

if that works then you may want to automate this in your .basrc

sebastian-luna-valero commented 6 years ago

Thanks, both.

Apart from PYTHONPATH, could you also print out:

echo $LD_LIBRARY_PATH

A minor amendment to @Acribbs comments above. The steps to setup your PYTHONPATH correctly would be:

# first clean up
unset PYTHONPATH

# provided that your install folder is:
DEST="$HOME/src/cgat"

# the activation steps are:
source ${DEST}/conda-install/bin/activate cgat-s
export PYTHONPATH=${DEST}/cgat

Please let us know how you get on.

Best regards, Sebastian

Acribbs commented 6 years ago

Thanks @sebastian-luna-valero,

just to clarify, would that mean you would get $HOME/src/cgat/cgat as your PYTHONPATH?

sebastian-luna-valero commented 6 years ago

Thanks Adam, for pointing that out.

Sorry, it should be PYTHONPATH=$HOME/src/cgat/cgat-scripts

sebastian-luna-valero commented 6 years ago

Updates:

In my comment above:

export PYTHONPATH=${DEST}/cgat

should actually be:

export PYTHONPATH=${DEST}/cgat-scripts

But more importantly, once you source ${DEST}/conda-install/bin/activate cgat-s, the command cgat bed2psl --help should just work. So I am now more inclined to think that the responsible for the error above should be LD_LIBRARY_PATH

If possible, please report:

# value of LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH

source ${DEST}/conda-install/bin/activate cgat-s

# value of LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH
SchwarzEM commented 6 years ago

I've followed the consensus of the advice above.

Long story short -- cgat bed2psl --help still does not work, and although $LD_LIBRARY_PATH has plenty of directories in it, none of them include CGAT libraries that might be needed to make bed2psl function properly.

Here are the details of what I've just run:

unset PYTHONPATH ;
export DEST="$HOME/src/cgat" ;
source ${DEST}/conda-install/bin/activate cgat-s ;
export PYTHONPATH=${DEST}/cgat-scripts ;

[Once more unto the breach, dear friends, once more!]

cgat bed2psl --help ;

[Whoops, failure:]

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

[But notice that this, at least, does superficially work;]

cgat --help ;

cgat.py - Computational Genomics Analysis Tools [etc. etc.]

[OK, let's take a look at this dubious variable, then.]

echo $LD_LIBRARY_PATH ;

/opt/software/cudatoolkit/6.0/computeprof/bin:/opt/software/cudatoolkit/6.0/lib64:/opt/software/cudatoolkit/6.0/lib:/opt/software/R/2.15.1--GCC-4.4.5/lib64/R/lib:/opt/software/boost/1.47.0--GCC-4.4.5/lib:/opt/software/ClusterStudio/2013sp1/composer_xe_2013_sp1.0.080/mkl/lib/intel64:/opt/software/MATLAB/R2014a/sys/opengl/lib/glnxa64:/opt/software/Python/2.7.2--GCC-4.4.5/lib/python2.7/lib-dynload:/opt/software/Python/2.7.2--GCC-4.4.5/lib:/opt/software/ClusterStudio/2011.0/composerxe-2011.5.220/tbb/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21/irml:/opt/software/ClusterStudio/2011.0/composerxe-2011.5.220/tbb/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21:/opt/software/OpenMPI/1.4.3--GCC-4.4.5/lib:/mnt/home/emsch/lib:/mnt/home/emsch/lib64

None of these directories overlap with anything inside the CGAT installation.

So, now what should I do?

sebastian-luna-valero commented 6 years ago

Thanks!

Could you unset your LD_LIBRARY_PATH, please?

unset LD_LIBRARY_PATH ;
unset PYTHONPATH ;
export DEST="$HOME/src/cgat" ;
source ${DEST}/conda-install/bin/activate cgat-s ;
export PYTHONPATH=${DEST}/cgat-scripts ;

Does this make any difference?

Best regards, Sebastian

SchwarzEM commented 6 years ago

I've tried that too. It makes no difference. I have to wonder: should I be explicitly setting LD_LIBRARY_PATH to have some value that would give this a chance to work?

Here are the details of what I just did:

export DEST="$HOME/src/cgat" ;
cd $DEST ;

unset PYTHONPATH ;
unset LD_LIBRARY_PATH ;

source ${DEST}/conda-install/bin/activate cgat-s ;
export PYTHONPATH=${DEST}/cgat-scripts ;

cgat bed2psl --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

echo $PYTHONPATH ;   # had previously been empty

/mnt/home/emsch/src/cgat/cgat-scripts

echo $LD_LIBRARY_PATH ;   # had previously had lots of unhelpful directories

[still nothing!]

source deactivate ;    # sigh
Acribbs commented 6 years ago

Setting the $LD_LIBRARY_PATH is usually only required for shared libraries. I assume that @sebastian-luna-valero was asking to unset your path because it contained shared libraries for python2.7 i.e.

/opt/software/Python/2.7.2--GCC-4.4.5/lib/python2.7/lib-dynload:/opt/software/Python/2.7.2--GCC-4.4.5/lib

I will try to do some more digging into this, unfortunately sebastian is now on holiday for a week. Just as another sanity check, are you able to run these two scripts: cgat bam2bam --help and cgat bed2bed --help?

AndreasHeger commented 6 years ago

Hi, I think the issue that some multiple python versions got muddled. One possible quick-fix could be: (best with an LD_LIBRARY_PATH that does not include any python's and within the cgat conda environment):

  1. remove all the .so files
    find /mnt/home/emsch/src/cgat/cgat-scripts/CGAT -name "*.so" -exec rm {} \;
  2. Go to the CGAT installation and rebuild:
    cd  /mnt/home/emsch/src/cgat/cgat-scripts
    python setup.py develop
SchwarzEM commented 6 years ago

Briefly: I reinstalled conda (as part of Anaconda2, which is Python2-based, not Python3-based), then reinstalled CGAT, then followed the advice above to the best of my understanding. Things still did not work.

Here, I'll give the full line-by-line story of what I've done. In the next post, I'll ask a few questions about what things I might be able to do to fix the problems I'm encountering.

What I did:

cd $HOME ;

# delete my pre-existing Anaconda2 and CGAT installations:
mv -i .bashrc-anaconda2.bak .bashrc ;
rm -rf .conda .condarc ;
rm -rf anaconda2 ;
rm -rf src/cgat ;

Log out, log back in, do the Anaconda2 installation from scratch, then do the manual editing of .bashrc to fit what I'm learning I should be doing.

cd $HOME ;

wget https://repo.continuum.io/archive/Anaconda2-5.1.0-Linux-x86_64.sh ;
md5sum Anaconda2-5.1.0-Linux-x86_64.sh | grep 5b1b5784cae93cf696e11e66983d8756 ;

5b1b5784cae93cf696e11e66983d8756 Anaconda2-5.1.0-Linux-x86_64.sh

bash Anaconda2-5.1.0-Linux-x86_64.sh ;

Accept default installation site: /mnt/home/emsch/anaconda2 Let the whole installation happen; then check on the .bashrc files.

cd $HOME ;

diff .bashrc-anaconda2.bak .bashrc ;

15a16,18
> 
> # added by Anaconda2 installer
> export PATH="/mnt/home/emsch/anaconda2/bin:$PATH"

which conda ;

~/anaconda2/bin/conda

conda activate ;

""" CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. If your shell is Bash or a Bourne variant, enable conda for the current user with

$ echo ". /mnt/home/emsch/anaconda2/etc/profile.d/conda.sh" >> ~/.bashrc

[etc. etc.] """

cp -ip .bashrc .bashrc-orig_anaconda2.mod ;
pico .bashrc ;

diff .bashrc-orig_anaconda2.mod .bashrc ;

17,18c17,18
< # added by Anaconda2 installer
< export PATH="/mnt/home/emsch/anaconda2/bin:$PATH"
---
> # manually added to make conda in Anaconda2 installation work properly
> . /mnt/home/emsch/anaconda2/etc/profile.d/conda.sh ;

Log out, log back in, check again:

cd $HOME ;

which conda ;

/usr/bin/which: no conda in [...]

conda activate ;

Now we get '(base)' in prompt.

which conda ;

~/anaconda2/bin/conda

Do basic setup to get bioconda functioning.

conda config --add channels defaults ;
conda config --add channels conda-forge ;
conda config --add channels bioconda ;
conda update -n base conda ; 

conda deactivate ;

Log out, log back in, activate conda, then within activated conda try doing the CGAT installation again.

cd $HOME/src ;
conda activate ;

which python ;

~/anaconda2/bin/python

echo $PYTHONPATH ;

(No lines.)

echo $LD_LIBRARY_PATH | perl -ne 's/[:]/\n/g; print; ' ;

/opt/software/cudatoolkit/6.0/computeprof/bin /opt/software/cudatoolkit/6.0/lib64 /opt/software/cudatoolkit/6.0/lib /opt/software/R/2.15.1--GCC-4.4.5/lib64/R/lib /opt/software/boost/1.47.0--GCC-4.4.5/lib /opt/software/ClusterStudio/2013sp1/composer_xe_2013_sp1.0.080/mkl/lib/intel64 /opt/software/MATLAB/R2014a/sys/opengl/lib/glnxa64 /opt/software/Python/2.7.2--GCC-4.4.5/lib/python2.7/lib-dynload /opt/software/Python/2.7.2--GCC-4.4.5/lib /opt/software/ClusterStudio/2011.0/composerxe-2011.5.220/tbb/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21/irml /opt/software/ClusterStudio/2011.0/composerxe-2011.5.220/tbb/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21 /opt/software/OpenMPI/1.4.3--GCC-4.4.5/lib /mnt/home/emsch/lib /mnt/home/emsch/lib64

echo $LD_LIBRARY_PATH | perl -ne 's/[:]/\n/g; print; ' | grep ython ;

/opt/software/Python/2.7.2--GCC-4.4.5/lib/python2.7/lib-dynload /opt/software/Python/2.7.2--GCC-4.4.5/lib

ls -l /opt/software/Python/2.7.2--GCC-4.4.5/lib | grep ython ;

-rwxrwxr-x 1 johnj helpdesk 9752110 Jan 11 2012 libpython2.7.a -rwxrwxr-x 1 johnj helpdesk 10248318 Sep 2 2011 libpython2.7.a.orig lrwxrwxrwx 1 johnj helpdesk 19 Mar 17 2017 libpython2.7.so -> libpython2.7.so.1.0 -rwxrwxr-x 1 johnj helpdesk 5990394 Jan 11 2012 libpython2.7.so.1.0 drwxrwsr-x 28 johnj helpdesk 643 Apr 21 2016 python2.7

ls -l /mnt/home/emsch/anaconda2/lib | grep ython ;

lrwxrwxrwx 1 emsch beacon 19 Apr 15 15:04 libpython2.7.so -> libpython2.7.so.1.0 -rwxr-xr-x 1 emsch beacon 2042048 Apr 15 15:04 libpython2.7.so.1.0 drwxr-xr-x 28 emsch beacon 451 Apr 15 15:08 python2.7

ls /opt/software/Python/2.7.2--GCC-4.4.5/lib/python2.7/lib-dynload/*.so | wc -l ;

62

ls /mnt/home/emsch/anaconda2/lib/python2.7/lib-dynload/*.so | wc -l ;

60

Oh wait ... CGAT is based on Python 3.6.3! Can an installation with Python2-based conda (Anaconda2) work at all? Ask this question, but also try doing the installation with Anaconda2.

cd $HOME ;

cat revise_LD_LIBRARY_PATH.sh ;

export LD_LIBRARY_PATH=/opt/software/cudatoolkit/6.0/computeprof/bin:\ /opt/software/cudatoolkit/6.0/lib64:\ /opt/software/cudatoolkit/6.0/lib:/opt/software/R/2.15.1--GCC-4.4.5/lib64/R/lib:\ /opt/software/boost/1.47.0--GCC-4.4.5/lib:\ /opt/software/ClusterStudio/2013sp1/composer_xe_2013_sp1.0.080/mkl/lib/intel64:\ /opt/software/MATLAB/R2014a/sys/opengl/lib/glnxa64:\ /opt/software/ClusterStudio/2011.0/composerxe-2011.5.220/tbb/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21/irml:\ /opt/software/ClusterStudio/2011.0/composerxe-2011.5.220/tbb/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21:\ /opt/software/OpenMPI/1.4.3--GCC-4.4.5/lib:\ /mnt/home/emsch/lib:/mnt/home/emsch/lib64 ;

[This effectively deletes the following from LD_LIBRARY_PATH -- :/opt/software/Python/2.7.2--GCC-4.4.5/lib/python2.7/lib-dynload:/opt/software/Python/2.7.2--GCC-4.4.5/lib ]

source revise_LD_LIBRARY_PATH.sh ;   # bash doesn't seem to work

cd $HOME/src ;

conda activate ;  # this puts us in (base) of 'conda activate'

# download installation script:
curl -O https://raw.githubusercontent.com/CGATOxford/cgat/master/install-CGAT-tools.sh ;

mkdir $HOME/src/cgat ;
bash install-CGAT-tools.sh --devel --location $HOME/src/cgat ;

""" Warning: 2 possible package resolutions (only showing differing packages):

Installed /mnt/home/emsch/src/cgat/cgat-scripts Processing dependencies for CGAT==0.3.2 Finished processing dependencies for CGAT==0.3.2

The code was successfully installed!

To activate the CGAT environment type: $ source /mnt/home/emsch/src/cgat/conda-install/bin/activate cgat-s

To deactivate the environment, use: $ source deactivate """

mv -i install-CGAT-tools.sh cgat ;

echo $PYTHONPATH ;

Zero lines.

export DEST="$HOME/src/cgat" ;

unset PYTHONPATH ;
export PYTHONPATH=${DEST}/cgat-scripts ;

source ${DEST}/conda-install/bin/activate cgat-s ;

cgat --help ;

""" cgat.py - Computational Genomics Analysis Tools [...] WIGGLE Transformation PSL
BIGWIG GFF MultipleAlignments
BEDGRAPH Comparison
"""

cgat bed2psl --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bam2bam --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 159, in import _bam2bam ModuleNotFoundError: No module named '_bam2bam'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 161, in import CGAT.scripts._bam2bam as _bam2bam ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bam.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bed2bed --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2bed.py", line 168, in import CGAT.Bed as Bed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Bed.py", line 29, in from CGAT import NCL as ncl File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/init.py", line 1, in from . import cnestedlist ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/cnestedlist.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

Try deleting *.so and then rebuilding:

find /mnt/home/emsch/src/cgat/cgat-scripts/CGAT -name "*.so" | perl -ne ' $input = $_; chomp $input; print "rm $input ;\n" ; ' > job.sh ;

cat job.sh ;

rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/GeneModelAnalysis.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/cnestedlist.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Timeseries/cmetrics.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bam.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2stats.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_gtf2table.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2geneprofile.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2peakshape.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bed.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bams2bam.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so ;

bash job.sh ;
rm job.sh ;

cd $HOME/src/cgat/cgat-scripts ;
python setup.py develop ;

""" [...] Creating /mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/site-packages/CGAT.egg-link (link to .) Adding CGAT 0.3.2 to easy-install.pth file Installing cgat script to /mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin

Installed /mnt/home/emsch/src/cgat/cgat-scripts Processing dependencies for CGAT==0.3.2 Finished processing dependencies for CGAT==0.3.2 """

cgat --help ;

""" cgat.py - Computational Genomics Analysis Tools [...] WIGGLE Transformation PSL
BIGWIG GFF MultipleAlignments
BEDGRAPH Comparison
"""

cgat bed2psl --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bam2bam --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 159, in import _bam2bam ModuleNotFoundError: No module named '_bam2bam'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 161, in import CGAT.scripts._bam2bam as _bam2bam ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bam.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bed2bed --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2bed.py", line 168, in import CGAT.Bed as Bed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Bed.py", line 29, in from CGAT import NCL as ncl File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/init.py", line 1, in from . import cnestedlist ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/cnestedlist.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

... so this is completely failing.

One thing I might have done would have been to prepend the following to LIB or to PYTHONPATH:

/mnt/home/emsch/anaconda2/lib/python2.7/lib-dynload
/mnt/home/emsch/anaconda2/lib

Or maybe, these?

ls -l $HOME/src/cgat/conda-install/lib | grep ython ;

-rwxr-xr-x 1 emsch beacon 22628068 Apr 15 16:53 libpython3.6m.a lrwxrwxrwx 1 emsch beacon 20 Apr 15 16:53 libpython3.6m.so -> libpython3.6m.so.1.0 lrwxrwxrwx 1 emsch beacon 20 Apr 15 16:53 libpython3.6m.so.1 -> libpython3.6m.so.1.0 -rwxr-xr-x 1 emsch beacon 3571976 Apr 15 16:53 libpython3.6m.so.1.0 drwxr-xr-x 35 emsch beacon 209 Apr 15 16:53 python3.6

ls -l $HOME/src/cgat/conda-install/lib/python3.6/lib-dynload/*.so | wc -l ;

65

Go ahead and try the latter possibility myself. Here is the original order of directories I had in $LD_LIBRARY_PATH:

/opt/software/cudatoolkit/6.0/computeprof/bin /opt/software/cudatoolkit/6.0/lib64 /opt/software/cudatoolkit/6.0/lib /opt/software/R/2.15.1--GCC-4.4.5/lib64/R/lib /opt/software/boost/1.47.0--GCC-4.4.5/lib /opt/software/ClusterStudio/2013sp1/composer_xe_2013_sp1.0.080/mkl/lib/intel64 /opt/software/MATLAB/R2014a/sys/opengl/lib/glnxa64 /opt/software/Python/2.7.2--GCC-4.4.5/lib/python2.7/lib-dynload /opt/software/Python/2.7.2--GCC-4.4.5/lib /opt/software/ClusterStudio/2011.0/composerxe-2011.5.220/tbb/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21/irml /opt/software/ClusterStudio/2011.0/composerxe-2011.5.220/tbb/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21 /opt/software/OpenMPI/1.4.3--GCC-4.4.5/lib /mnt/home/emsch/lib /mnt/home/emsch/lib64

cp -ip /mnt/home/emsch/revise_LD_LIBRARY_PATH.sh /mnt/home/emsch/revise_LD_LIBRARY_PATH_w_CGAT_python.sh ;
pico /mnt/home/emsch/revise_LD_LIBRARY_PATH_w_CGAT_python.sh ;

cat /mnt/home/emsch/revise_LD_LIBRARY_PATH_w_CGAT_python.sh ;

export LD_LIBRARY_PATH=/mnt/home/emsch/src/cgat/conda-install/lib/python3.6/lib-dynload:/mnt/home/emsch/src/cgat/conda-install/lib:/opt/software/cudatoolkit/6.0/computeprof/bin:/opt/software/cudatoolkit/6.0/lib64:/opt/software/cudatoolkit/6.0/lib:/opt/software/R/2.15.1--GCC-4.4.5/lib64/R/lib:/opt/software/boost/1.47.0--GCC-4.4.5/lib:/opt/software/ClusterStudio/2013sp1/composer_xe_2013_sp1.0.080/mkl/lib/intel64:/opt/software/MATLAB/R2014a/sys/opengl/lib/glnxa64:/opt/software/ClusterStudio/2011.0/composerxe-2011.5.220/tbb/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21/irml:/opt/software/ClusterStudio/2011.0/composerxe-2011.5.220/tbb/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21:/opt/software/OpenMPI/1.4.3--GCC-4.4.5/lib:/mnt/home/emsch/lib:/mnt/home/emsch/lib64 ;

source /mnt/home/emsch/revise_LD_LIBRARY_PATH_w_CGAT_python.sh ;

source deactivate ;
source ${DEST}/conda-install/bin/activate cgat-s ;

cgat --help ;

[standard help message]

cgat bed2psl --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bam2bam --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 159, in import _bam2bam ModuleNotFoundError: No module named '_bam2bam'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 161, in import CGAT.scripts._bam2bam as _bam2bam ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bam.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bed2bed --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2bed.py", line 168, in import CGAT.Bed as Bed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Bed.py", line 29, in from CGAT import NCL as ncl File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/init.py", line 1, in from . import cnestedlist ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/cnestedlist.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

Try one more time to delete *.so files and rebuild them:

cd $DEST ;

find /mnt/home/emsch/src/cgat/cgat-scripts/CGAT -name "*.so" | perl -ne ' $input = $_; chomp $input; print "rm $input ;\n" ; ' > job.sh ;

cat job.sh ;

rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/GeneModelAnalysis.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/cnestedlist.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Timeseries/cmetrics.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bam.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2stats.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_gtf2table.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2geneprofile.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2peakshape.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bed.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bams2bam.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so ;

bash job.sh ;
rm job.sh ;

cd $HOME/src/cgat/cgat-scripts ;
python setup.py develop ;

""" [...] Creating /mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/site-packages/CGAT.egg-link (link to .) Adding CGAT 0.3.2 to easy-install.pth file Installing cgat script to /mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin

Installed /mnt/home/emsch/src/cgat/cgat-scripts Processing dependencies for CGAT==0.3.2 Finished processing dependencies for CGAT==0.3.2 """

source deactivate ;

cd $DEST ;
source ${DEST}/conda-install/bin/activate cgat-s ;

cgat --help ;

""" cgat.py - Computational Genomics Analysis Tools [... """

cgat bed2psl --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bam2bam --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 159, in import _bam2bam ModuleNotFoundError: No module named '_bam2bam'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 161, in import CGAT.scripts._bam2bam as _bam2bam ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bam.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bed2bed --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2bed.py", line 168, in import CGAT.Bed as Bed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Bed.py", line 29, in from CGAT import NCL as ncl File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/init.py", line 1, in from . import cnestedlist ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/cnestedlist.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

Short of doing a complete reinstall of Anaconda3 and trying to create a conda environment based on Python3 rather than Python2, I'm not sure what I'm supposed to be doing here.

SchwarzEM commented 6 years ago

@Acribbs wrote: "are you able to run these two scripts: cgat bam2bam --help and cgat bed2bed --help?"

I tried both of these. They have both persistently failed. You can see the gory long details in my immediately preceding post...

SchwarzEM commented 6 years ago

@AndreasHeger wrote: "I think the issue that some multiple python versions got muddled. One possible quick-fix could be: (best with an LD_LIBRARY_PATH that does not include any python's and within the cgat conda environment)..."

I tried this, and it did not succeed. However, it is very far from obvious to me that I have either the correct Python version in Anaconda, or the correct directories within cgat pre-pended to LD_LIBRARY_PATH.

So, my questions:

  1. I was installing Anaconda2 rather thoughtlessly. However, Anaconda2 is Python2-based. CGAT, I observe, is Python3-based. Should I instead install Anaconda3, and activate conda from the Anaconda3 base environment before starting to install and debug CGAT?

  2. Exactly what directories within CGAT should I be pre-pending to LD_LIBRARY_PATH? Please assume that I know practically nothing about Python (because, this is true), and that I therefore cannot be relied upon to think of stupidly obvious stuff.

  3. I was trying to get an appropriate value of PYTHONPATH with the following commands. However, are there other directories within CGAT that I should also have been adding to PYTHONPATH?

    export DEST="$HOME/src/cgat" ; unset PYTHONPATH ; export PYTHONPATH=${DEST}/cgat-scripts ;

Acribbs commented 6 years ago

Hi,

r.e. running 3 different scripts: Some of those scripts use cython code some do not so wanted to eliminate this as the underlying issue.

My take on your questions, but @AndreasHeger may have other ideas.

  1. If you are using our script for the install: As part of our installation process we install a version of miniconda (Anaconda has the habit of modifying your basrc (and I think maybe PYTHONPATH)), therefore anaconda is not required. Are you able to comment out the location of your anaconda PATH in your .bashrc. This could be a source of conflicts (particularly if you are still specifying a location to python 2 code. To activate the CGAT environment after installation you would just need to run source </full/path/to/folder/without/trailing/slash>/conda-install/bin/activate cgat-s after installation.

  2. Setting your LD_LIBRARY_PATH is generally a bad idea for a number of issues (most relating to security), please see here for some further explanation: http://wiredrevolution.com/system-administration/how-to-correctly-use-ld_library_path. Therefore, if you can remove all of the locations to any python versions, you shouldn't get conflicts during setup develop.

  3. The python path you suggest should be fine.

Acribbs commented 6 years ago

Just as another note, because you said you were new to python. Python 2 will no longer be supported from 2020, so if you can I would move completely to python3. https://pythonclock.org

SchwarzEM commented 6 years ago

Thank you, @Acribbs, for the advice so far!

I have attempted to follow it completely. For whatever reason, this has not led any of my scripts to work properly -- they're still exploding in Pythonic chaos when I try to run them.

Here's a detailed account of what I did:

cd $HOME ;

pico .bashrc ;   # comment out ". /mnt/home/emsch/anaconda2/etc/profile.d/conda.sh ;"

Log out and log back in. Then:

cd $HOME/src ; 

rm -rf $HOME/src/cgat ;
mkdir $HOME/src/cgat ;

unset PYTHONPATH ;
unset LD_LIBRARY_PATH ;

# download installation script:
curl -O https://raw.githubusercontent.com/CGATOxford/cgat/master/install-CGAT-tools.sh ;

bash install-CGAT-tools.sh --devel --location $HOME/src/cgat ;

Get a whole bunch of text while installation proceeds:

# install-CGAT-tools.sh log | dev-intel14-k20 | Mon Apr 16 15:04:40 EDT 2018 | installing conda 
# install-CGAT-tools.sh log | dev-intel14-k20 | Mon Apr 16 15:04:40 EDT 2018 | downloading miniconda 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                Dload  Upload   Total   Spent    Left  Speed
100 54.9M  100 54.9M    0     0  20.6M      0  0:00:02  0:00:02 --:--:-- 22.0M
# install-CGAT-tools.sh log | dev-intel14-k20 | Mon Apr 16 15:04:43 EDT 2018 | installing miniconda 
PREFIX=/mnt/home/emsch/src/cgat/conda-install
installing: python-3.6.3-h6c0c0dc_5 ...
Python 3.6.3 :: Anaconda, Inc.
installing: ca-certificates-2017.08.26-h1d4fec5_0 ...
installing: conda-env-2.6.0-h36134e3_1 ...
installing: libgcc-ng-7.2.0-h7cc24e2_2 ...
installing: libstdcxx-ng-7.2.0-h7a57d05_2 ...
installing: libffi-3.2.1-hd88cf55_4 ...
[...]
Warning: 2 possible package resolutions (only showing differing packages):
  - bioconda::bioconductor-masigpro-1.50.0-0
  - bioconda::bioconductor-masigpro-1.50.0-r3.4.1_0
post-link :: /etc/machine-id not found ..
dbus post-link :: .. using /proc/sys/kernel/random/boot_id
[.....]
Creating /mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/site-packages/CGAT.egg-link (link to .)
Adding CGAT 0.3.2 to easy-install.pth file
Installing cgat script to /mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin
Installed /mnt/home/emsch/src/cgat/cgat-scripts
Processing dependencies for CGAT==0.3.2
Finished processing dependencies for CGAT==0.3.2
The code was successfully installed!
To activate the CGAT environment type: 
$ source /mnt/home/emsch/src/cgat/conda-install/bin/activate cgat-s
To deactivate the environment, use:
$ source deactivate

So, let's see if this works! Verify that conda isn't already in our $PATH; activate CGAT; see if conda has appeared in our $PATH (which implies that everything else has been properly made available); fix $PYTHONPATH; try running CGAT scripts.

which conda ;

/usr/bin/which: no conda in (/mnt/home/emsch/perl5/bin: [etc. etc.]

export DEST="$HOME/src/cgat" ;

export PYTHONPATH=${DEST}/cgat-scripts ;

source ${DEST}/conda-install/bin/activate cgat-s ;

which conda ;

~/src/cgat/conda-install/envs/cgat-s/bin/conda

cgat --help ;

[reasonable help message]

cgat --help all ;

[...] bed2psl [...]

cgat bed2psl --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bam2bam --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 159, in import _bam2bam ModuleNotFoundError: No module named '_bam2bam'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 161, in import CGAT.scripts._bam2bam as _bam2bam ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bam.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bed2bed --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2bed.py", line 168, in import CGAT.Bed as Bed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Bed.py", line 29, in from CGAT import NCL as ncl File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/init.py", line 1, in from . import cnestedlist ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/cnestedlist.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

which python ;    # so, where is Python?

~/src/cgat/conda-install/envs/cgat-s/bin/python

~/src/cgat/conda-install/envs/cgat-s/bin/python --version ;   # and is this Python 3?

Python 3.6.3

SchwarzEM commented 6 years ago

Also, I tried rebuilding the *.so files with the Python3 provided by CGAT; that, also, failed to help.

Here are details:

# source ${DEST}/conda-install/bin/activate cgat-s ;

cd $DEST ;

find /mnt/home/emsch/src/cgat/cgat-scripts/CGAT -name "*.so" | perl -ne ' $input = $_; chomp $input; print "rm $input ;\n" ; ' > job.sh ;

cat job.sh ;

rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Timeseries/cmetrics.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/cnestedlist.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/GeneModelAnalysis.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_gtf2table.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2geneprofile.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2stats.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bams2bam.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bed.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bam.cpython-36m-x86_64-linux-gnu.so ; rm /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2peakshape.cpython-36m-x86_64-linux-gnu.so ;

bash job.sh ;
rm job.sh ;

cd $HOME/src/cgat/cgat-scripts ;

which python ;

~/src/cgat/conda-install/envs/cgat-s/bin/python

python setup.py develop ;

[long set of messages, ending in...] Creating /mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/site-packages/CGAT.egg-link (link to .) Adding CGAT 0.3.2 to easy-install.pth file Installing cgat script to /mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin

Installed /mnt/home/emsch/src/cgat/cgat-scripts Processing dependencies for CGAT==0.3.2 Finished processing dependencies for CGAT==0.3.2 [then, try one more time...]

cgat bed2psl --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bam2bam --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 159, in import _bam2bam ModuleNotFoundError: No module named '_bam2bam'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 161, in import CGAT.scripts._bam2bam as _bam2bam ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bam.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bed2bed --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2bed.py", line 168, in import CGAT.Bed as Bed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Bed.py", line 29, in from CGAT import NCL as ncl File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/init.py", line 1, in from . import cnestedlist ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/cnestedlist.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

source deactivate ;    # give up for now.
sebastian-luna-valero commented 6 years ago

Hi @SchwarzEM

Sorry for all the hassle. I am surprised you did not have the same error messages when you raised a previous issue https://github.com/CGATOxford/cgat/issues/388 . I assume you are now installing the code in a different runtime environment.

Can I ask you to try the following steps instead, please?

# first remove the previous installation of the cgat code, then:

# 1. Make sure you unset LD_LIBRARY_PATH beforehand
unset LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH

# 2. The same for PYTHONPATH
unset PYTHONPATH
echo $PYTHONPATH

# 3. Download and install the code:
DEST="$HOME/src/cgat"
curl -O https://raw.githubusercontent.com/CGATOxford/cgat/master/install-CGAT-tools.sh
bash install-CGAT-tools.sh --devel --location ${DEST}
source ${DEST}/conda-install/bin/activate cgat-s
cgat --help
cgat bed2bed --help

If that works, then you should always unset both LD_LIBRARY_PATH and PYTHONPATH before you enable and use the cgat command:

unset LD_LIBRARY_PATH
unset PYTHONPATH
source /full/path/to/folder/without/trailing/slash/conda-install/bin/activate cgat-s
cgat bed2bed --help

Could you please let me know how it goes?

Best regards, Sebastian

SchwarzEM commented 6 years ago

Hi @sebastian-luna-valero,

Unfortunately, following your instructions hasn't fixed any of the problems. Here's what I got when I tried:

cd /mnt/home/emsch/src ;
rm -rf install-CGAT-tools.sh cgat ;

unset LD_LIBRARY_PATH ;
echo $LD_LIBRARY_PATH ;
# empty; previously had been full

unset PYTHONPATH ;
echo $PYTHONPATH ;
# empty

DEST="$HOME/src/cgat" ;

curl -O https://raw.githubusercontent.com/CGATOxford/cgat/master/install-CGAT-tools.sh ;

bash install-CGAT-tools.sh --devel --location ${DEST} ;

[Lots of text messages:] envs directories : /mnt/home/emsch/src/cgat/conda-install/envs /mnt/home/emsch/.conda/envs package cache : /mnt/home/emsch/src/cgat/conda-install/pkgs /mnt/home/emsch/.conda/pkgs [...]

Warning: 2 possible package resolutions (only showing differing packages):

dbus post-link :: .. using /proc/sys/kernel/random/boot_id

[...] [... finally ...] Adding CGAT 0.3.2 to easy-install.pth file Installing cgat script to /mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin

Installed /mnt/home/emsch/src/cgat/cgat-scripts Processing dependencies for CGAT==0.3.2 Finished processing dependencies for CGAT==0.3.2

The code was successfully installed!

To activate the CGAT environment type: $ source /mnt/home/emsch/src/cgat/conda-install/bin/activate cgat-s

To deactivate the environment, use: $ source deactivate

source ${DEST}/conda-install/bin/activate cgat-s ;

cgat --help ;

cgat.py - Computational Genomics Analysis Tools [etc. etc.; basically looks OK] CGAT tools are grouped by keywords. The following keywords are defined:

Python GFF Annotation
Genomics Manipulation GenomeAlignment
NGS Variants CHAIN
FASTQ Protein WIGGLE
FASTA Transformation BIGWIG
Conversion Summary BEDGRAPH
Sequences Genesets Geneset
Intervals BAM MultipleAlignments
Comparison GTF Statistics
BED Fasta Power
Counting PSL

cgat bed2bed --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2bed.py", line 168, in import CGAT.Bed as Bed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Bed.py", line 29, in from CGAT import NCL as ncl File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/init.py", line 1, in from . import cnestedlist ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/cnestedlist.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bam2bam --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 159, in import _bam2bam ModuleNotFoundError: No module named '_bam2bam'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 161, in import CGAT.scripts._bam2bam as _bam2bam ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bam.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bed2psl --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

So, failure once again.

SchwarzEM commented 6 years ago

Here's a question: although I believe CGAT is supposed to import most of what it needs in order to compile itself (starting with miniconda), I assume that it does not try to import GCC compilers (gcc and g++).

What version(s) of gcc and g++ are optimal for installing and running CGAT? Is one reason that I keep getting messages like this:

ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol:

that CGAT really wants gcc 6+, but my system default is 4.8.5?

SchwarzEM commented 6 years ago

I went ahead and re-installed CGAT after deleting not only the pre-existing installation, but my preexisting anaconda2 installation and its hidden directories -- to get rid of any files that might be confusing the installation.

Result: again, failure of the modules to run.

Details:

cd $HOME/src ;
source deactivate ;
rm -rf install-CGAT-tools.sh cgat ;

cd /mnt/home/emsch ;
rm -rf anaconda2 .condarc .conda ;

cd /mnt/home/emsch/src ;

# verify that these are still zeroed out
echo $LD_LIBRARY_PATH ;
echo $PYTHONPATH ;

# and verify that I still have results of: 'DEST="$HOME/src/cgat" ;'
echo $DEST ;

/mnt/home/emsch/src/cgat

curl -O https://raw.githubusercontent.com/CGATOxford/cgat/master/install-CGAT-tools.sh ;

bash install-CGAT-tools.sh --devel --location ${DEST} ;

[lots of messages]

source ${DEST}/conda-install/bin/activate cgat-s ;

cgat --help ;

[standard, OK-looking messages]

cgat bed2bed --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2bed.py", line 168, in import CGAT.Bed as Bed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Bed.py", line 29, in from CGAT import NCL as ncl File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/init.py", line 1, in from . import cnestedlist ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/NCL/cnestedlist.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bam2bam --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 159, in import _bam2bam ModuleNotFoundError: No module named '_bam2bam'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bam2bam.py", line 161, in import CGAT.scripts._bam2bam as _bam2bam ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/_bam2bam.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

cgat bed2psl --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 11, in load_entry_point('CGAT', 'console_scripts', 'cgat')() File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/cgat.py", line 129, in main module = imp.load_module(command, file, pathname, description) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 235, in load_module return load_source(name, filename, file) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/scripts/bed2psl.py", line 27, in import CGAT.Blat as Blat File "/mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Blat.py", line 25, in from CGAT import Components as Components ImportError: /mnt/home/emsch/src/cgat/cgat-scripts/CGAT/Components.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_ZeroStruct

SchwarzEM commented 6 years ago

So, 22 days ago, I had a reasonable solution proposed by @sebastian-luna-valero in #388 -- namely, do a standard installation of CGAT with the "--production" option rather than the "--devel" option, then run these commands to patch bed2psl.py into CGAT:

cd conda-install/envs/cgat-s/lib/python3.6/site-packages/CGAT/scripts ;
wget https://raw.githubusercontent.com/CGATOxford/cgat/master/CGAT/scripts/bed2psl.py ;

But it seemed more elegant to do a "--devel" installation, so I tried that instead. As my posts on this github ticket indicate, misery ensued. For three weeks, that somehow kept me from remembering the original, untried suggestion.

Tonight I finally snapped out of my mental fog and tried it. Surprise! It actually seems to work! Moreover, other scripts seem to work too!

Here's what I did:

cd /mnt/home/emsch/src ;

unset LD_LIBRARY_PATH ;
echo $LD_LIBRARY_PATH ;
# empty; previously had been full

unset PYTHONPATH ;
echo $PYTHONPATH ;
# empty

DEST="$HOME/src/cgat" ;

curl -O https://raw.githubusercontent.com/CGATOxford/cgat/master/install-CGAT-tools.sh ;
bash install-CGAT-tools.sh --production --location ${DEST} ;

[long messages]

# enable the conda environment as requested by the installation script:
source $DEST/conda-install/bin/activate cgat-s ;

# run the cgat command-line tool to check the installation:
cgat --help ;

[looks OK]

cgat bam2bed --help ;

[works! or, at least, gives clean help message...]

cgat bed2bed --help ;

[! works! or, at least, gives clean help message...]

cgat bam2bam --help ;

[!! works! or, at least, gives clean help message...] [Note that all of these had failed in the "--development" installation of CGAT.]

cgat bed2psl --help ;

Traceback (most recent call last): File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/bin/cgat", line 6, in sys.exit(CGAT.cgat.main()) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/site-packages/CGAT/cgat.py", line 128, in main (file, pathname, description) = imp.find_module(command, [path, ]) File "/mnt/home/emsch/src/cgat/conda-install/envs/cgat-s/lib/python3.6/imp.py", line 297, in find_module raise ImportError(_ERR_MSG.format(name), name=name) ImportError: No module named 'bed2psl'

[Which is the error message I should see, given that bed2psl.py isn't in the --production version of CGAT. So, try patching in the script.]

cd $DEST/conda-install/envs/cgat-s/lib/python3.6/site-packages/CGAT/scripts ;
wget https://raw.githubusercontent.com/CGATOxford/cgat/master/CGAT/scripts/bed2psl.py ;

cd $HOME/src ;   # not necessary, but hey

cgat bed2psl --help ;

[Voila! A clean-looking help message, rather than an explosion of Pythonic failure!] Usage: bed2psl.py - convert a bed file to a psl file [etc. etc. etc.]

From this, I conclude that the problem wasn't that I'm utterly incompetent at getting CGAT installed. When I used "--production" to install it, I get scripts whose help messages (at least) run just fine. The problem isn't my system either (although it may have been prudent to unset LD_LIBRARY_PATH before installing and running CGAT). The problem, at least in my hands, is that "--devel" installations of CGAT do not work.

sebastian-luna-valero commented 6 years ago

Thanks for your feedback @SchwarzEM and sorry for all the hassle.

It is sad to see that after all the effort we put into making the installation of the code portable, it still does not work and waste other people's time out there.

The differences between the installation of --production and --devel can be see by comparing their conda environments:

There must be a conflict in the --devel environment and your runtime environment but I am not able to see why. Both installations download gcc-4.8.5 and are supposed to use it when cythoning the relevant scripts.

Please note that with the --production installation, only scripts in the manifest are guaranteed to work, and bed2psl should be considered an exception.

I will close this issue now but feel free to reopen if you want to follow up.