Code Monkey home page Code Monkey logo

Comments (13)

Strilanc avatar Strilanc commented on June 15, 2024

Interestingly, when I separately run sudo pip3 install pybind11, then sudo pip3 install projectq starts to work.

Maybe the package is not correctly specifying pybind11 as a dependency?

from projectq.

Strilanc avatar Strilanc commented on June 15, 2024

Repro steps:

mkvirtualenv tmp
pip install projectq   #FAILS

pip install pybind11
pip install projectq   #WORKS

from projectq.

damiansteiger avatar damiansteiger commented on June 15, 2024

pybind11 is correctly included in the requirements.txt:

https://github.com/ProjectQ-Framework/ProjectQ/blob/master/requirements.txt

from projectq.

Strilanc avatar Strilanc commented on June 15, 2024

Any ideas why pip install projectq would switch from failing to succeeding after installing pybind?

from projectq.

thomashaener avatar thomashaener commented on June 15, 2024

I have no clue and I think it's really weird that pip does not install pybind despite it being a requirement.

from projectq.

Strilanc avatar Strilanc commented on June 15, 2024

Matthew thinks it's because of line 30 in setup.py, which has to build an Extension that uses pybind11. But this is before the setup call that actually installs pybind11.

from projectq.

maffoo avatar maffoo commented on June 15, 2024

It looks like this could work if we could tell pip to install the required libraries before building the extension module.

from projectq.

Strilanc avatar Strilanc commented on June 15, 2024

Line 146 creates an exception but doesn't raise it?

from projectq.

maffoo avatar maffoo commented on June 15, 2024

I think there might be a problem with the 0.2.0 package that was uploaded to pypi. If I checkout git master and do pip install . it works. But pip install projectq fails in the way @Strilanc mentioned, and it also fails if I download the 0.2.0 tarfile from pypi and try to run pip install . there.

Edit: false alarm; the 0.2.0 tarfile seems to behave the same as master, so at least the uploaded archive matches git. Still a problem with getting the version from pypi, however.

from projectq.

maffoo avatar maffoo commented on June 15, 2024

Ok, I think I see the problem. As of version 6.0.1, pip does a topological sort on dependencies before installing them, so that dependencies of package foo get installed before foo itself. Prior versions of pip did not make this guarantee. If I create a new virtualenv on my system (ubuntu 14.04) I get the ancient system version of pip, version 1.5.4. In that case after collecting all the packages, pip says:

Installing collected packages: projectq, numpy, future, pytest, pybind11, requests, py
  Running setup.py install for projectq

So basically it is trying to install projectq before pybind11, which fails. The solution is to update pip itself in the virtualenv:

$ pip install --upgrade pip

Then when I run pip install projectq I get the following:

Installing collected packages: numpy, future, py, pytest, pybind11, requests, projectq

Crucially, it installs pybind11 before projectq and everything works fine.

from projectq.

Strilanc avatar Strilanc commented on June 15, 2024

I notice a lot of install instructions often start with pip install --upgrade pip, presumably because of stuff like this... makes me think the package should really be able to declare a minimum version of pip.

from projectq.

thomashaener avatar thomashaener commented on June 15, 2024

Thanks @Strilanc and @maffoo, this is good to know.
Also, I added the missing 'raise' in setup.py. Thanks for pointing this out!

from projectq.

maffoo avatar maffoo commented on June 15, 2024

My only other suggestion would be to add a note in the tutorial to let users know they might need to update pip before installing projectq itself. Aside from that I think we can close this issue.

from projectq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.