nansencenter / nansat

Scientist friendly Python toolbox for processing 2D satellite Earth observation data.
http://nansat.readthedocs.io
GNU General Public License v3.0
182 stars 66 forks source link

Automatic installation of requirements fails with Python3 on Ubuntu 18.04 #431

Closed ninsbl closed 5 years ago

ninsbl commented 5 years ago

On Ubuntu 18.04 with Python 3, nansat installation fails if requirements are not installed first:

sudo pip3 install nansat
[sudo] password for stefan: 
The directory '/home/stefan/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/stefan/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting nansat
Collecting pythesint (from nansat)
  Downloading https://files.pythonhosted.org/packages/d0/c9/3d222f337384dc9ed2cd5cf575d52d14701f10b945b45026a2feae493504/pythesint-1.4.7.tar.gz
Requirement already satisfied: Pillow in ./.local/lib/python3.6/site-packages (from nansat)
Requirement already satisfied: urllib3 in /usr/lib/python3/dist-packages (from nansat)
Requirement already satisfied: python-dateutil in /usr/lib/python3/dist-packages (from nansat)
Requirement already satisfied: gdal in /usr/lib/python3/dist-packages (from nansat)
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from nansat)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from pythesint->nansat)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from pythesint->nansat)
Collecting xdg<=1.0.7 (from pythesint->nansat)
  Downloading https://files.pythonhosted.org/packages/79/5a/c8e3f778998c3aedc74b55dff2852fe5952eac115bcf53adcb8565031435/xdg-1.0.7-py2.py3-none-any.whl
Installing collected packages: xdg, pythesint, nansat
  Running setup.py install for pythesint ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-e56wcpdc/pythesint/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-95tmeqc4-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/pythesint
    copying pythesint/json_vocabulary.py -> build/lib/pythesint
    copying pythesint/iso19115_vocabulary.py -> build/lib/pythesint
    copying pythesint/gcmd_vocabulary.py -> build/lib/pythesint
    copying pythesint/cf_vocabulary.py -> build/lib/pythesint
    copying pythesint/__init__.py -> build/lib/pythesint
    copying pythesint/pythesint.py -> build/lib/pythesint
    copying pythesint/wkv_vocabulary.py -> build/lib/pythesint
    copying pythesint/pathsolver.py -> build/lib/pythesint
    copying pythesint/vocabulary.py -> build/lib/pythesint
    creating build/lib/pythesint/tests
    copying pythesint/tests/test_vocabulary.py -> build/lib/pythesint/tests
    copying pythesint/tests/test_pythesint.py -> build/lib/pythesint/tests
    copying pythesint/tests/__init__.py -> build/lib/pythesint/tests
    copying pythesint/tests/test_gcmd_vocabulary.py -> build/lib/pythesint/tests
    running egg_info
    writing pythesint.egg-info/PKG-INFO
    writing dependency_links to pythesint.egg-info/dependency_links.txt
    writing requirements to pythesint.egg-info/requires.txt
    writing top-level names to pythesint.egg-info/top_level.txt
    reading manifest file 'pythesint.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'pythesint.egg-info/SOURCES.txt'
    copying pythesint/pythesintrc.yaml -> build/lib/pythesint
    running install_lib
    creating /usr/local/lib/python3.6/dist-packages/pythesint
    copying build/lib/pythesint/json_vocabulary.py -> /usr/local/lib/python3.6/dist-packages/pythesint
    copying build/lib/pythesint/iso19115_vocabulary.py -> /usr/local/lib/python3.6/dist-packages/pythesint
    copying build/lib/pythesint/gcmd_vocabulary.py -> /usr/local/lib/python3.6/dist-packages/pythesint
    copying build/lib/pythesint/cf_vocabulary.py -> /usr/local/lib/python3.6/dist-packages/pythesint
    copying build/lib/pythesint/__init__.py -> /usr/local/lib/python3.6/dist-packages/pythesint
    copying build/lib/pythesint/pythesintrc.yaml -> /usr/local/lib/python3.6/dist-packages/pythesint
    copying build/lib/pythesint/pythesint.py -> /usr/local/lib/python3.6/dist-packages/pythesint
    copying build/lib/pythesint/wkv_vocabulary.py -> /usr/local/lib/python3.6/dist-packages/pythesint
    creating /usr/local/lib/python3.6/dist-packages/pythesint/tests
    copying build/lib/pythesint/tests/test_vocabulary.py -> /usr/local/lib/python3.6/dist-packages/pythesint/tests
    copying build/lib/pythesint/tests/test_pythesint.py -> /usr/local/lib/python3.6/dist-packages/pythesint/tests
    copying build/lib/pythesint/tests/__init__.py -> /usr/local/lib/python3.6/dist-packages/pythesint/tests
    copying build/lib/pythesint/tests/test_gcmd_vocabulary.py -> /usr/local/lib/python3.6/dist-packages/pythesint/tests
    copying build/lib/pythesint/pathsolver.py -> /usr/local/lib/python3.6/dist-packages/pythesint
    copying build/lib/pythesint/vocabulary.py -> /usr/local/lib/python3.6/dist-packages/pythesint
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/json_vocabulary.py to json_vocabulary.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/iso19115_vocabulary.py to iso19115_vocabulary.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/gcmd_vocabulary.py to gcmd_vocabulary.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/cf_vocabulary.py to cf_vocabulary.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/__init__.py to __init__.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/pythesint.py to pythesint.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/wkv_vocabulary.py to wkv_vocabulary.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/tests/test_vocabulary.py to test_vocabulary.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/tests/test_pythesint.py to test_pythesint.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/tests/__init__.py to __init__.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/tests/test_gcmd_vocabulary.py to test_gcmd_vocabulary.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/pathsolver.py to pathsolver.cpython-36.pyc
    byte-compiling /usr/local/lib/python3.6/dist-packages/pythesint/vocabulary.py to vocabulary.cpython-36.pyc
    running install_egg_info
    Copying pythesint.egg-info to /usr/local/lib/python3.6/dist-packages/pythesint-1.4.7.egg-info
    running install_scripts
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-e56wcpdc/pythesint/setup.py", line 84, in <module>
        cmdclass = {'install_scripts': update_vocabularies}
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.6/distutils/command/install.py", line 601, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-e56wcpdc/pythesint/setup.py", line 30, in run
        import pythesint as pti
      File "/tmp/pip-build-e56wcpdc/pythesint/pythesint/__init__.py", line 2, in <module>
        from pythesint.pythesint import update_all_vocabularies
      File "/tmp/pip-build-e56wcpdc/pythesint/pythesint/pythesint.py", line 39, in <module>
        _process_config()
      File "/tmp/pip-build-e56wcpdc/pythesint/pythesint/pythesint.py", line 18, in _process_config
        config = yaml.load(resource_string(__name__, 'pythesintrc.yaml'), Loader=yaml.FullLoader)
    AttributeError: module 'yaml' has no attribute 'FullLoader'

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-e56wcpdc/pythesint/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-95tmeqc4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-e56wcpdc/pythesint/

However, this works:

$ sudo pip3 install pythesint
The directory '/home/stefan/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/stefan/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pythesint in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from pythesint)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from pythesint)
Requirement already satisfied: xdg<=1.0.7 in /usr/local/lib/python3.6/dist-packages (from pythesint)

And then:

$ sudo pip3 install nansat
The directory '/home/stefan/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/stefan/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting nansat
Requirement already satisfied: Pillow in ./.local/lib/python3.6/site-packages (from nansat)
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from nansat)
Requirement already satisfied: pythesint in /usr/local/lib/python3.6/dist-packages (from nansat)
Requirement already satisfied: python-dateutil in /usr/lib/python3/dist-packages (from nansat)
Requirement already satisfied: urllib3 in /usr/lib/python3/dist-packages (from nansat)
Requirement already satisfied: gdal in /usr/lib/python3/dist-packages (from nansat)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from pythesint->nansat)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from pythesint->nansat)
Requirement already satisfied: xdg<=1.0.7 in /usr/local/lib/python3.6/dist-packages (from pythesint->nansat)
Installing collected packages: nansat
Successfully installed nansat-1.2.1

Would be nice if requirements are installed automatically...

akorosov commented 5 years ago

I'm quite puzzled by this. The recent version of YAML must have FullLoader. So the error message in the first block of PIP outputs seems unreasonable. What makes even less sense is that Pythesint was installed automatically on the second go...

Could it be that between the first output and the second one there was an update of YAML?