Skip to content

Problems with custom install command in setup.py #41

@sbliven

Description

@sbliven

The current (v 1.0.0.dev1) setup.py gives an error when install from pypi:

$ pip install tral==1.0.0.dev1
Collecting tral==1.0.0.dev1
  Using cached https://files.pythonhosted.org/packages/bd/1f/aab6087db655c8aba77e482427f29a7ba499e65908b8537d56662ef49dfb/tral-1.0.0.dev1.tar.gz
Requirement already satisfied: biopython>=1.64 in /usr/local/miniconda3/envs/tral/lib/python3.7/site-packages/biopython-1.73-py3.7-macosx-10.7-x86_64.egg (from tral==1.0.0.dev1) (1.73)
Requirement already satisfied: configobj>=5.0.6 in /usr/local/miniconda3/envs/tral/lib/python3.7/site-packages/configobj-5.0.6-py3.7.egg (from tral==1.0.0.dev1) (5.0.6)
Requirement already satisfied: numpy>=1.6.1 in /usr/local/miniconda3/envs/tral/lib/python3.7/site-packages/numpy-1.16.2-py3.7-macosx-10.7-x86_64.egg (from tral==1.0.0.dev1) (1.16.2)
Requirement already satisfied: scipy>=0.12.0 in /usr/local/miniconda3/envs/tral/lib/python3.7/site-packages/scipy-1.2.1-py3.7-macosx-10.7-x86_64.egg (from tral==1.0.0.dev1) (1.2.1)
Requirement already satisfied: six in /usr/local/miniconda3/envs/tral/lib/python3.7/site-packages (from configobj>=5.0.6->tral==1.0.0.dev1) (1.12.0)
Building wheels for collected packages: tral
  Building wheel for tral (setup.py): started
  Building wheel for tral (setup.py): finished with status 'error'
  Complete output from command /usr/local/miniconda3/envs/tral/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qq/fxkml5kx4pq9jqxt09967pyc0000gn/T/pip-install-mwuz8br4/tral/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 /private/var/folders/qq/fxkml5kx4pq9jqxt09967pyc0000gn/T/pip-wheel-yo1mzvhj --python-tag cp37:
  running bdist_wheel
  running build
  running build_py
  creating build
  ...
  installing to build/bdist.macosx-10.7-x86_64/wheel
  running install
  The TRAL configuration directory /Users/bliven_s/.tral already exists. The template configuration and datafiles are not copied to the already existing directory at this step.
  Checking .pth file support in build/bdist.macosx-10.7-x86_64/wheel/
  /usr/local/miniconda3/envs/tral/bin/python -E -c pass
  TEST FAILED: build/bdist.macosx-10.7-x86_64/wheel/ does NOT support .pth files
  error: bad install directory or PYTHONPATH
  
  You are attempting to install a package to a directory that is not
  on PYTHONPATH and which Python does not read ".pth" files from.  The
  installation directory you specified (via --install-dir, --prefix, or
  the distutils default setting) was:
  
      build/bdist.macosx-10.7-x86_64/wheel/
  
  and your PYTHONPATH environment variable currently contains:
  
      ''
  
  Here are some of your options for correcting the problem:
  
  * You can choose a different installation directory, i.e., one that is
    on PYTHONPATH or supports .pth files
  
  * You can add the installation directory to the PYTHONPATH environment
    variable.  (It must then also be on PYTHONPATH whenever you run
    Python and want to use the package(s) you are installing.)
  
  * You can set up the installation directory to support ".pth" files by
    using one of the approaches described here:
  
    https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations
  
  
  Please make the appropriate changes for your system and try again.
  
  ----------------------------------------
  Failed building wheel for tral
  Running setup.py clean for tral
Failed to build tral
Installing collected packages: tral
  Running setup.py install for tral: started
    Running setup.py install for tral: finished with status 'done'
  Could not find .egg-info directory in install record for tral==1.0.0.dev1 from https://files.pythonhosted.org/packages/bd/1f/aab6087db655c8aba77e482427f29a7ba499e65908b8537d56662ef49dfb/tral-1.0.0.dev1.tar.gz#sha256=ce10162ba1bf55153b5605dad2358664652bc904fda6e9b32719b1aa8b3756cd
Successfully installed tral

This seems to be caused by our custom install & develop commands, which have caused a lot of problems over time. They were implemented as a way to support alternate install locations for tral home.

History:

  • In 0.3.5 the --home was manually detected and stripped out of sys.argv. This overwrote the normal setuptools --home parameter, only worked if it was the first parameter, and seemed hackish.
  • I switched this to use custom cmdclass overriding the default install and develop commands. This is very poorly documented but is often suggested on stackoverflow.
  • The overridden 'run' function should call super.run(). However, due to some fancy introspection this causes install_requires to get ignored when running python setup.py install. The suggested fix is to run super().do_egg_install() instead of super.run().
  • But do_egg_install() seems to break pip install

Solution

I think we should strip out the custom parameter entirely. This is also the solution suggested here. Instead, data should be installed at runtime when needed. This will also let us fix #9 finally and could integrate well with #29.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions