Skip to content

Unable to build project with numpy #1624

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
capcarr opened this issue Sep 3, 2015 · 7 comments
Closed

Unable to build project with numpy #1624

capcarr opened this issue Sep 3, 2015 · 7 comments

Comments

@capcarr
Copy link

capcarr commented Sep 3, 2015

I'm unable to build the documentation for my project, which depends on numpy (and scipy and matplotlib). The build fails with a RequirementParseError for numpy. Here's the log: https://readthedocs.org/projects/biosppy/builds/3295858/

Under Admin->Advanced Settings I have both the options "Install your project inside a virtualenv using setup.py install" and "Give the virtual environment access to the global site-packages dir." checked.

@agjohnson
Copy link
Contributor

I can replicate the issue locally with pip==7.1.0 and your requirements file. The error is from pip, which is stating you have a malformed spec for numpy. I'm not sure what makes the spec malformed here though.

Closing as this isn't a Read the Docs issue.

@capcarr
Copy link
Author

capcarr commented Sep 4, 2015

OK, thanks.

Can you suggest any workarounds in the mean time?

@agjohnson
Copy link
Contributor

Try a standard pip freeze in your virtualenv to create a valid requirements.txt

@capcarr
Copy link
Author

capcarr commented Sep 17, 2015

For future reference, I was only able to build my documentation by specifying an empty requirements file in RTD Admin, and by mocking any 3rd party packages in conf.py, as is described in the FAQ.

@drvinceknight
Copy link

For future reference, I was only able to build my documentation by specifying an empty requirements file in RTD Admin, and by mocking any 3rd party packages in conf.py, as is described in the FAQ.

I tried this approach (and a large number of others) for #1671 but without any success.

@capcarr
Copy link
Author

capcarr commented Sep 21, 2015

What settings are you using in RTD?

I have these checked, under the Advanced Settings:

  • Install your project inside a virtualenv
  • Give the virtual environment access to the global site-packages dir

And the requirements file is pointing to an empty file (actually two empty lines).

In the conf.py file I have (I'm using Python 2.7):

from mock import Mock as MagicMock

class Mock(MagicMock):
    @classmethod
    def __getattr__(cls, name):
            return Mock()

MOCK_MODULES = ['numpy', 'scipy', 'matplotlib', 'matplotlib.pyplot',
                'scipy.signal', 'scipy.interpolate', 'scipy.optimize',
                'scipy.stats', 'scipy.cluster', 'scipy.cluster.hierarchy',
                'scipy.cluster.vq', 'scipy.sparse', 'scipy.spatial',
                'scipy.spatial.distance', 'sklearn', 'sklearn.cluster',
                'sklearn.grid_search', 'sklearn.externals',
                'matplotlib.gridspec', 'h5py', 'shortuuid', 'bidict', 'svm',
                'sksvm']

sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

@drvinceknight
Copy link

I've tried that (I've been going through every single solution and permutation thereof I kind find). I've opened another issue #1671 in the hope of figuring this out (another core dev and I spent about 4 hours trying to fix this today).

Not sure if this is of interest but here's the build log: https://readthedocs.org/projects/axelrod/builds/3340162/

and here's a pic of my (latest) settings: https://www.dropbox.com/s/9ua3xq2ww8165y9/Screenshot%202015-09-21%2018.26.56.png?dl=0

for that my latest build failed with this mock in the conf (I copied exactly yours and added some matplotlib sub libraries, and then just had the ones I use: no difference all failed):

 18 from mock import Mock as MagicMock
 19
 20 class Mock(MagicMock):
 21     @classmethod
 22     def __getattr__(cls, name):
 23             return Mock()
 24
 25 MOCK_MODULES = ['numpy', 'scipy', 'matplotlib', 'matplotlib.pyplot',
 26                 'matplotlib.transforms', 'mpl_toolkits.axes_grid1',
 27                 'axelrod']
 28
 29 sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

I have also removed all uses of autodoc in case that was relevant. Thanks for answering: much appreciated.

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

No branches or pull requests

3 participants