UCSF-TI / TIPCC-Tools

Scripts for TIPCC (not really useful elsewhere)
1 stars 0 forks source link

Setting PYTHONPATH causes problems in some cases #11

Open HenrikBengtsson opened 7 years ago

HenrikBengtsson commented 7 years ago

For instance, since CBC tools sets:

[cbctest@cclc01 ~]$ echo $PYTHONPATH
/home/cbctest/.local/bin::/home/shared/cbc/software_cbc/anaconda/lib/python2.7

we get:

[cbctest@cclc01 ~]$ cellprofiler --help
Traceback (most recent call last):
  File "/usr/cellprofiler/src/CellProfiler/CellProfiler.py", line 14, in <module>
    import h5py
  File "/usr/cellprofiler/lib/python2.7/site-packages/h5py/__init__.py", line 16, in <module>
    from h5py import h5a, h5d, h5ds, h5f, h5fd, h5g, h5r, h5s, h5t, h5p, h5z
  File "h5t.pxd", line 14, in init h5py.h5a (h5py/h5a.c:6114)
  File "numpy.pxd", line 66, in init h5py.h5t (h5py/h5t.c:17957)
  File "/usr/cellprofiler/lib/python2.7/site-packages/numpy/__init__.py", line 170, in <module>
    from . import add_newdocs
  File "/usr/cellprofiler/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/cellprofiler/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/cellprofiler/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/cellprofiler/lib/python2.7/site-packages/numpy/core/__init__.py", line 46, in <module>
    from numpy.testing import Tester
  File "/usr/cellprofiler/lib/python2.7/site-packages/numpy/testing/__init__.py", line 13, in <module>
    from .utils import *
  File "/usr/cellprofiler/lib/python2.7/site-packages/numpy/testing/utils.py", line 15, in <module>
    from tempfile import mkdtemp
  File "/home/shared/cbc/software_cbc/anaconda/lib/python2.7/tempfile.py", line 35, in <module>
    from random import Random as _Random
  File "/home/shared/cbc/software_cbc/anaconda/lib/python2.7/random.py", line 47, in <module>
    from os import urandom as _urandom
ImportError: cannot import name urandom

Unsetting PYTHONPATH solved the problem;

[cbctest@cclc01 ~]$ export PYTHONPATH=
[cbctest@cclc01 ~]$ cellprofiler --help | head
Usage: CellProfiler.py [options] [<output-file>])
         where <output-file> is the optional filename for the output file of 
               measurements when running headless. 
         The flags -p, -r and -c are required for a headless run.

Options:
  -h, --help            show this help message and exit
  -p PIPELINE_FILENAME, --pipeline=PIPELINE_FILENAME, --project=PIPELINE_FILENAME
                        Load this pipeline file or project on startup. If
                        specifying a pipeline file rather than a project, the