The Unfun Cat
The Unfun Cat

Reputation: 31948

ImportError: No module named 'Cython' when installing requirements on readthedocs server

I'd like to use an extension to autogenerate the output of examples in code snippets for readthedocs. I have found a module that does this, sphinx-autorun. However, when I try to install all the modules required by my package (in the requirements for readthedocs) I get an error in the build log of readthedocs, namely:

Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-tsfmsady/clustertree/setup.py", line 6, in <module>
    from Cython.Build import cythonize
ImportError: No module named 'Cython' 

Any tips on how to fix this? I have the following options set:

enter image description here

enter image description here

Upvotes: 1

Views: 861

Answers (1)

The Unfun Cat
The Unfun Cat

Reputation: 31948

A conda-based build worked for me.

You can put a readthedocs.yml in the root folder of your repo (not your docs folder):

requirements_file:
  docs/requirements.txt

conda:
    file: environment.yml

My conda environment.yml:

channels:
- conda-forge
- bioconda
- r
- jkroes
dependencies:
- cython
- python=3.6
- numpy
- pandas
- sphinx-autorun=1.1.0=py36h5809654_0

You can even have a pip-section in the conda yaml:

channels:
- conda-forge
- bioconda
- r
- jkroes
dependencies:
- cython
- python=3.6
- numpy
- pandas
- pip:
    - clustertree
    - pyranges
    - sphinx_autorun_ebs
    - pyrle
    - sorted_nearest

Upvotes: 1

Related Questions