Skip to content

Fix pip installation to work without pre-installed numpy/cython #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed

Fix pip installation to work without pre-installed numpy/cython #266

wants to merge 8 commits into from

Conversation

stefanistrate
Copy link

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Motivation and context / Related issue

This will fix the installation process through pip. No need for pre-installed numpy and cython, as mentioned here: https://pypi.org/project/POT/

How has this been tested (if it applies)

Installation (and compillation) from the github repository through pip finished successfully.

Checklist

  • The documentation is up-to-date with the changes I made.
  • I have read the CONTRIBUTING document.
  • All tests passed, and additional code has been covered with new tests.

@agramfort
Copy link
Collaborator

@stefanistrate thx ! are the CIs failure related? I suspect the CIs script should be updated so cython is not installed upfront in order to check this new build scenario.

@stefanistrate
Copy link
Author

@stefanistrate thx ! are the CIs failure related? I suspect the CIs script should be updated so cython is not installed upfront in order to check this new build scenario.

Yes, those are related indeed. Let me have another try at fixing this.

When you're saying that the "CI script should be updated", you mean removing this line? I imagine the whole Get Python running block should look something like this:

        - run:
            name: Get Python running
            command: |
              python -m pip install --user --upgrade --progress-bar off pip
              python -m pip install --user -e .
              python -m pip install --user --upgrade --progress-bar off -r docs/requirements.txt
              python -m pip install --user --upgrade --progress-bar off ipython "https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master" memory_profiler

instead of the current version:

        - run:
            name: Get Python running
            command: |
              python -m pip install --user --upgrade --progress-bar off pip
              python -m pip install --user --upgrade --progress-bar off -r requirements.txt
              python -m pip install --user --upgrade --progress-bar off -r docs/requirements.txt
              python -m pip install --user --upgrade --progress-bar off ipython "https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master" memory_profiler
              python -m pip install --user -e .

@stefanistrate
Copy link
Author

I made some changes in the meantime and I'm waiting for all the workflows to run, but I noticed that the CircleCI workflows fail with some sort of writing permission error:

Installing collected packages: numpy, scipy, POT
  Running setup.py develop for POT
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/circleci/project/setup.py'"'"'; __file__='"'"'/home/circleci/project/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=
         cwd: /home/circleci/project/
    Complete output (32 lines):
    running develop
    /tmp/pip-build-env-j5lnnt5f/overlay/lib/python3.7/site-packages/setuptools/dist.py:700: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
      % (opt, underscore_opt))
    /tmp/pip-build-env-j5lnnt5f/overlay/lib/python3.7/site-packages/setuptools/dist.py:484: UserWarning: Normalizing '0.8.0dev' to '0.8.0.dev0'
      warnings.warn(tmpl.format(**locals()))
    WARNING: The user site-packages directory is disabled.
    error: can't create or remove files in install directory
    
    The following error occurred while trying to add or remove files in the
    installation directory:
    
        [Errno 13] Permission denied: '/usr/local/lib/python3.7/site-packages/test-easy-install-1050.write-test'
    
    The installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:
    
        /usr/local/lib/python3.7/site-packages/
    
    Perhaps your account does not have write access to this directory?  If the
    installation directory is a system-owned directory, you may need to sign in
    as the administrator or "root" account.  If you do not have administrative
    access to this machine, you may wish to choose a different installation
    directory, preferably one that is listed in your PYTHONPATH environment
    variable.

I don't think this is because of my change. Can you take a look?

@rflamary
Copy link
Collaborator

Hello @stefanistrate thank you so much for this PR. We are working on the release 0.8 right now and we think this will help a lot of people.

Since we did some change in the setup.py you had some conflicts so I have been working on PR #293 to test the build without installing the requirements, first and it seems to work in all cases now.

@stefanistrate
Copy link
Author

Great to see this!

@rflamary
Copy link
Collaborator

PR #293 is merged with your suggestion. I'm closing this PR.

Thank you again for introducing me to pyproject.toml (honestly there is no good documentation on this) this will make our life easier ;)

@rflamary rflamary closed this Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants