stanfordmlgroup / chexpert-labeler

CheXpert NLP tool to extract observations from radiology reports.
MIT License
340 stars 79 forks source link

Error installing bllip-parser from environment.yml without gcc and gxx #20

Closed MaxGhenis closed 4 years ago

MaxGhenis commented 4 years ago

Per https://github.com/BLLIP/bllip-parser/issues/67, installing bllip-parser on Linux may require the GCC and GXX packages. I had the same error when loading the environment here. Adding this to environment.yml addressed it:

  - gcc_linux-64
  - gxx_linux-64
tinahuang222 commented 3 years ago

Adding gcc_linux-64 and gxx_linux-64 to the environment*.yml is not sufficient to solve the problem. The bug still occurred, unable to pip install bllipparser because of gcc problem.

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
  ERROR: Command errored out with exit status 1:
   command: /home/tina/anaconda3/envs/negbio2.7/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qutDBb/bllipparser/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qutDBb/bllipparser/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-tzarLX --python-tag cp27
       cwd: /tmp/pip-install-qutDBb/bllipparser/
  Complete output (24 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/bllipparser
  copying python/bllipparser/__main__.py -> build/lib.linux-x86_64-2.7/bllipparser
  copying python/bllipparser/RerankingParser.py -> build/lib.linux-x86_64-2.7/bllipparser
  copying python/bllipparser/ParsingShell.py -> build/lib.linux-x86_64-2.7/bllipparser
  copying python/bllipparser/ModelFetcher.py -> build/lib.linux-x86_64-2.7/bllipparser
  copying python/bllipparser/Utility.py -> build/lib.linux-x86_64-2.7/bllipparser
  copying python/bllipparser/CharniakParser.py -> build/lib.linux-x86_64-2.7/bllipparser
  copying python/bllipparser/RerankerFeatureCorpus.py -> build/lib.linux-x86_64-2.7/bllipparser
  copying python/bllipparser/__init__.py -> build/lib.linux-x86_64-2.7/bllipparser
  copying python/bllipparser/JohnsonReranker.py -> build/lib.linux-x86_64-2.7/bllipparser
  running build_ext
  building 'bllipparser._CharniakParser' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/first-stage
  creating build/temp.linux-x86_64-2.7/first-stage/PARSE
  creating build/temp.linux-x86_64-2.7/first-stage/PARSE/swig
  gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ifirst-stage/PARSE/ -I/home/tina/anaconda3/envs/negbio2.7/include/python2.7 -c first-stage/PARSE/swig/wrapper.C -o build/temp.linux-x86_64-2.7/first-stage/PARSE/swig/wrapper.o
  unable to execute 'gcc': No such file or directory
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for bllipparser
ERROR: negbio 0.9.4 has requirement bioc==1.3.1, but you'll have bioc 1.1.dev3 which is incompatible.
ERROR: negbio 0.9.4 has requirement docutils==0.14, but you'll have docutils 0.13.1 which is incompatible.
ERROR: negbio 0.9.4 has requirement nltk==3.4.5, but you'll have nltk 3.2.4 which is incompatible.
ERROR: negbio 0.9.4 has requirement pytest==4.4.1, but you'll have pytest 3.1.3 which is incompatible.
    ERROR: Command errored out with exit status 1:
     command: /home/tina/anaconda3/envs/negbio2.7/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qutDBb/bllipparser/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qutDBb/bllipparser/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-4b4HC9/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-qutDBb/bllipparser/
    Complete output (24 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/bllipparser
    copying python/bllipparser/__main__.py -> build/lib.linux-x86_64-2.7/bllipparser
    copying python/bllipparser/RerankingParser.py -> build/lib.linux-x86_64-2.7/bllipparser
    copying python/bllipparser/ParsingShell.py -> build/lib.linux-x86_64-2.7/bllipparser
    copying python/bllipparser/ModelFetcher.py -> build/lib.linux-x86_64-2.7/bllipparser
    copying python/bllipparser/Utility.py -> build/lib.linux-x86_64-2.7/bllipparser
    copying python/bllipparser/CharniakParser.py -> build/lib.linux-x86_64-2.7/bllipparser
    copying python/bllipparser/RerankerFeatureCorpus.py -> build/lib.linux-x86_64-2.7/bllipparser
    copying python/bllipparser/__init__.py -> build/lib.linux-x86_64-2.7/bllipparser
    copying python/bllipparser/JohnsonReranker.py -> build/lib.linux-x86_64-2.7/bllipparser
    running build_ext
    building 'bllipparser._CharniakParser' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/first-stage
    creating build/temp.linux-x86_64-2.7/first-stage/PARSE
    creating build/temp.linux-x86_64-2.7/first-stage/PARSE/swig
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ifirst-stage/PARSE/ -I/home/tina/anaconda3/envs/negbio2.7/include/python2.7 -c first-stage/PARSE/swig/wrapper.C -o build/temp.linux-x86_64-2.7/first-stage/PARSE/swig/wrapper.o
    unable to execute 'gcc': No such file or directory
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/tina/anaconda3/envs/negbio2.7/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qutDBb/bllipparser/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qutDBb/bllipparser/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-4b4HC9/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

failed

CondaEnvException: Pip failed

That's because executable cannot reconcile codes using gcc and g++ with installed packages gcc_linux-64 and gxx_linux-64 in this negbio* conda environment. To resolve that, you would have to manually add soft symbolic link within conda environment.

ln -s /path/to/anaconda3/envs/negbio2.7/bin/x86_64-conda_cos6-linux-gnu-gcc /path/to/anaconda3/envs/negbio2.7/bin/gcc ln -s /path/to/anaconda3/envs/negbio2.7/bin/x86_64-conda_cos6-linux-gnu-g++ /path/to/anaconda3/envs/negbio2.7/bin/g++

After properly linking the gcc and g++ executables, continue to update the conda environment.

source activate negbio2.7 conda env update -f environment2.7.yml