question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setup_requires equivalent for dependencies required by other modules

See original GitHub issue
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Question

I’m trying to use pyjnius which requires Cython to be installed first. Note that it probably isn’t loaded as an inner dependency by it (which I think should change, and I’m looking at https://github.com/kivy/pyjnius for solutions to it), but adding both pyjnius and cython in .toml file and doing a poetry install is resulting in failure, since pyjnius apparently requires Cython to be installed before its setup.

Complete output from command python setup.py egg_info:


    You need Cython to compile Pyjnius.


    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/wp/ss8wgxqs2pz2csrshmbkzvs80000gn/T/pip-install-pq9f9wz0/pyjnius/setup.py", line 65, in <module>
        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'

This is similar to https://github.com/sdispater/poetry/issues/37 since https://pypi.org/pypi/pyjnius/json doesn’t list cython as a required dependency but even adding cython manually to the toml file doesn’t work here.

The only thing that did work was doing poetry install twice, once with just cython and other time with pyjnius added, but of course, I can’t have this in an automated setup.

So is there a way to automate this weird pre-setup dependency case for this module with poetry ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:14
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
sangalinecommented, Nov 13, 2019

The same thing happens with scikit-learn v0.21.3.

      File "sklearn/utils/setup.py", line 8, in configuration
        from Cython import Tempita
    ModuleNotFoundError: No module named 'Cython'
1reaction
nirvana-msucommented, Jan 7, 2021

I’m having a similar issue while trying to install ray using a Nexus PyPI mirror. Ray depends on gpustat, for which installation fails with the error:

distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('pytest-runner')

Poetry fails to infer this dependency via parsing setup.py due to the way it is defined:

if sys.version_info >= (3, 5):
    tests_requires += ['pytest>=5.4.1']
    setup_requires += ['pytest-runner>=5.0'],
else:
    tests_requires += ['pytest<5.0', 'more_itertools<8.0']
    setup_requires += ['pytest-runner<5.0'],

Adding pytest-runner dependency to pyproject.toml is also not sufficient as gpustat gets installed before it.

As others have said, it can and should be fixed upstream, and it can also be addressed by doing poetry run pip install pytest-runner before poetry install, but that’s far from perfect…

It would be awesome if Poetry, as a workaround, provided a way to specify additional package dependencies within [tool.poetry.dependencies] section, something like the following:

gpustat = { version = "*", depends_on= ["pytest-runner"]}  # actually, to cater for a general case it should be possible to provide a version constraint for those dependencies

@sdispater does it make sense? It’s a workaround, but it would at least solve the problem in the short term…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setuptools platform specific dependencies - python
In my specific case, I'm using readline , which comes as part of the standard library on Unix systems, but on Windows I...
Read more >
How to Package Python dependencies with PIP setuptools
Use Python 3.9 by ActiveState and build your own runtime with the packages and dependencies you need. Get started for free by creating...
Read more >
Configuring setuptools using setup.cfg files
Setuptools allows using configuration files (usually setup.cfg ) to define a package's metadata and other options that are normally supplied to the setup() ......
Read more >
install_requires vs requirements files
When the project is installed by pip, this is the specification that is used to install its dependencies. For example, if the project...
Read more >
Spring Boot Reference Documentation
Other “Starters” provide dependencies that you are likely to need when ... If possible, always try to use the equivalent Java-based configuration.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found