Skip to content
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

pip install ignores --install-option=--enable-drafts #1500

Closed
richardwei6 opened this issue Jan 31, 2021 · 4 comments · Fixed by #1525
Closed

pip install ignores --install-option=--enable-drafts #1500

richardwei6 opened this issue Jan 31, 2021 · 4 comments · Fixed by #1525

Comments

@richardwei6
Copy link

richardwei6 commented Jan 31, 2021

A continuation of this issue: #1465

On the lastest versions of pyzmq, it seems that pyzmq doesn't recognize the --enable-drafts install option.

How do I know this? Well, back in pyzmq version 19.0.2, on MacOS, all you needed to use pyzmq was use this command: pip install pyzmq==19.0.2 -v --install-option=--enable-drafts. This would take the libzmq homebrew installation and bundle it with pyzmq. You can find the full instructions I typed up here.

I was able to test pyzmq draft functionality by:

import zmq
print(zmq.RADIO) # or zmq.DISH

if the above script prints out a number then we're good otherwise, we know pyzmq doesn't have drafts enabled.

In the latest versions of pyzmq, even if you run the exact same command as above (with the exact same libzmq homebrew installation), you will notice that both zmq.RADIO and zmq.DISH return no number.

It seems to me that an update between the current version and version 19.0.2 broke draft functionality in pyzmq.

Edit: before, on windows 10, pyzmq installation with the --enable-drafts install option would flat out not even build successfully but due to #1481 mentioned by @minrk in #1465, that seems to be fixed. However, due to the aforementioned bug with pyzmq not recognizing the --enable-drafts option with the latest versions of pyzmq, the test script above still doesn't give a number.

@minrk
Copy link
Member

minrk commented Feb 1, 2021

Can you include the full output of pip install (including the echoed compile commands)? Is libzmq already installed with drafts enabled, or are you relying on pyzmq to build libzmq with drafts itself?

@minrk
Copy link
Member

minrk commented Feb 1, 2021

I was able to reproduce this, and I think it's a bug in pip because --install-option is just getting ignored (not by pyzmq, pip is not passing the option to pyzmq). If you set with environment variables, I think it should work:

ZMQ_DRAFT_API=1 pip install --no-binary pyzmq pyzmq==22.0.2

If there's a relevant change in pyzmq, it may be the addition of pyproject.toml that causes pip to not handle install/build options as it used to.

@minrk minrk changed the title Broken draft functionality in latest versions even with "--enable-drafts" pip install ignores --install-option=--enable-drafts Feb 2, 2021
@richardwei6
Copy link
Author

Hello, sorry for the late reply.

On windows, I set the ZMQ_DRAFT_API environment variable by using this command: set ZMQ_DRAFT_API=1.

Then, I run this command: pip install --no-binary pyzmq pyzmq==22.0.2 and get this output:

Creating library build\temp.win-amd64-3.9\Release\zmq\backend\cython\message.cp39-win_amd64.lib and object build\temp.win-amd64-3.9\Release\zmq\backend\cython\message.cp39-win_amd64.exp
  message.obj : error LNK2001: unresolved external symbol __imp_zmq_msg_set_group
  message.obj : error LNK2001: unresolved external symbol __imp_zmq_msg_group
  message.obj : error LNK2001: unresolved external symbol __imp_zmq_msg_set_routing_id
  message.obj : error LNK2001: unresolved external symbol __imp_zmq_msg_routing_id
  build\lib.win-amd64-3.9\zmq\backend\cython\message.cp39-win_amd64.pyd : fatal error LNK1120: 4 unresolved externals
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\link.exe' failed with exit code 1120
  ----------------------------------------
  ERROR: Failed building wheel for pyzmq
Failed to build pyzmq
ERROR: Could not build wheels for pyzmq which use PEP 517 and cannot be installed directly

@chghehe
Copy link

chghehe commented Mar 25, 2021

Same hell is here. Option --zmq is ignored as well.

Try to build and install pyzmq from sources:

  • Build and install libzmq with version you need. As fas as I know pyzmq cannot be built against static libzmq. That is why better to build shared library. Note that .dll must be in the same directory as import library .lib is (e.g.: $PREFIX/lib).
  • Build and install pyzmq:
    git clone git://github.com/zeromq/pyzmq.git
    cd pyzmq
    python setup.py configure --enable-drafts --zmq=$PREFIX
    python setup.py build  # I'm not sure that this step is neccessary
    pip install .
  • Since I use python 3.8+ On Windows (DLL resolution in Python 3.8 on Windows has changed Toblerity/Fiona#851), I copied .dll into cython directory under the package installation directory. Just placed it near .pyd files.

Hope this will help.

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 a pull request may close this issue.

3 participants