pyzmq: Unable to make pyzmq work on pypy 5.1.1 32 bit on Windows

Error on use of pyzmq-15.3.0.dev0

When importing pyzmq, compilation claims that “sys/un.h” doesn’t exist although there shouldn’t be such “sys/un.h” because of Windows.

C:\Users\Administrator>pypy -c "import zmq"
_cffi_ext.c
C:\pypy-5.1.1-win32\site-packages\zmq\backend\cffi\__pycache__\_cffi_ext.c(53) : fatal error C1083: Cannot open include file: 'sys/un.h': No such file or directory
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\pypy-5.1.1-win32\site-packages\zmq\__init__.py", line 56, in <module>
    from zmq import backend
  File "C:\pypy-5.1.1-win32\site-packages\zmq\backend\__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "C:\pypy-5.1.1-win32\site-packages\zmq\backend\__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "C:\pypy-5.1.1-win32\site-packages\zmq\backend\select.py", line 27, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "C:\pypy-5.1.1-win32\site-packages\zmq\backend\cffi\__init__.py", line 6, in <module>
    from zmq.backend.cffi import (constants, error, message, context, socket,
  File "C:\pypy-5.1.1-win32\site-packages\zmq\backend\cffi\constants.py", line 4, in <module>
    from ._cffi import C, c_constant_names
  File "C:\pypy-5.1.1-win32\site-packages\zmq\backend\cffi\_cffi.py", line 100, in <module>
    "Please check that you have zeromq headers and libraries." % e)
ImportError: PyZMQ CFFI backend couldn't find zeromq: CompileError: command 'C:\\Program Files (x86)\\Common Files\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
Please check that you have zeromq headers and libraries.

Error on installation of pyzmq-15.2.0

Building ZeroMQ doesn’t seem to work well.

C:\Users\Administrator>pypy -m pip install pyzmq
Collecting pyzmq
  Using cached pyzmq-15.2.0.zip
Requirement already satisfied (use --upgrade to upgrade): py in c:\pypy-5.1.1-win32\site-packages (from pyzmq)
Requirement already satisfied (use --upgrade to upgrade): cffi in c:\pypy-5.1.1-win32\lib_pypy (from pyzmq)
Installing collected packages: pyzmq
  Running setup.py install for pyzmq

...

    LINK : fatal error LNK1181: cannot open input file 'libsodium.lib'
    error: command 'C:\\Program Files (x86)\\Common Files\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\link.exe' failed with exit status 1181

Environment

Note

I’ve not tried http://zeromq.org/docs:windows-installations because I don’t have idea how to build libzmq\builds\msvc\vs2008\libzmq.sln without Visual Studio. (32 bit version of VCBuild.exe doesn’t seem to be included in VC++ for Python 27 so it is impossible to complete C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe libzmq\builds\msvc\vs2008\libzmq.sln.)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 27 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I ran into this issue under 64-bit Windows 10 when running jupyter notebook with Anaconda 4.3.1. However, pip uninstall pyzmq and pip install pyzmq did the work for me, even though pip warned me that

DEPRECATION: Uninstalling a distutils installed project (pyzmq) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.

I’m also experiencing this issue under OSX 10.11.4. This seems to be an issue with pyzmq’s bundled libzmq combined with pypy. Steps:

-pypy 5.4.1 via brew brew install pypy -pyzmq via pypy -m pip install pyzmq

I then get the same error as @alec-djinn

As a workaround if you install zeromq standalone (e.g. via brew) pyzmq no longer relies on its bundled libzmq, and all is right with the world. So:

-pypy -m pip uninstall pyzmq -brew install zeromq -pypy -m pip install pyzmq

I was facing the same issue when opening jupyter notebook:

_cffi_ext.c
D:\dev\programs\anaconda3\lib\site-packages\zmq\backend\cffi\__pycache__\_cffi_ext.c(268): fatal error C1083: Cannot open include file: 'zmq.h': No such file or directory
Traceback (most recent call last):
  File "D:\dev\programs\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
    from notebook.notebookapp import main
  File "D:\dev\programs\anaconda3\lib\site-packages\notebook\notebookapp.py", line 51, in <module>
    from zmq.eventloop import ioloop
  File "D:\dev\programs\anaconda3\lib\site-packages\zmq\__init__.py", line 50, in <module>
    from zmq import backend
  File "D:\dev\programs\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "D:\dev\programs\anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
    raise value
  File "D:\dev\programs\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "D:\dev\programs\anaconda3\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "D:\dev\programs\anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: DLL load failed while importing error: The specified module could not be found.

The pip install/uninstall pyzmq did not work for me. Running conda install jupyter resolved the issue (note all of these steps were performed while in a conda virtual environment).

I can import zmq on win 10 ,anaconda Python 3.7. However when i try to make it part of an executable via pyinstaller i get the exact same issue about missing sys/un.h. pip install/uninstall pyzmq does not help me in this case. Had anybody success with @sakurai-youhei´s fix? To me it leads to a new error:

"c:\programdata\anaconda3\lib\site-packages\zmq\backend\cffi\__pycache__\_cffi_ext.c(267):
'zmq.h': not found!"

@Johannes0Horn Did you find the solution for the issue you mentioned? I am having the same issue right now. The pyinstaller cannot work with pyzmq even if I downgrade the pyzmq version.

I can import zmq on win 10 ,anaconda Python 3.7. However when i try to make it part of an executable via pyinstaller i get the exact same issue about missing sys/un.h. pip install/uninstall pyzmq does not help me in this case. Had anybody success with @sakurai-youhei´s fix? To me it leads to a new error:

"c:\programdata\anaconda3\lib\site-packages\zmq\backend\cffi\__pycache__\_cffi_ext.c(267):
'zmq.h': not found!"

Because Python 2.7 is no longer supported, I have checked this with pypy3 again.

Windows: 10.0.18363 pypy3: https://bitbucket.org/pypy/pypy/downloads/pypy3.6-v7.3.0-win32.zip pyzmq: pyzmq-19.0.0

And, I’d say nothing seems to have been changed so far; cl.exe reports C1083 due to missing sys/un.h.

C:\Users\sakurai\Desktop\pypy3.6-v7.3.0-win32>pypy3 -m ensurepip
Looking in links: c:\Users\sakurai\AppData\Local\Temp\tmpcubp4vct
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-19.2.3 setuptools-41.2.0

C:\Users\sakurai\Desktop\pypy3.6-v7.3.0-win32>pypy3 -m pip install pyzmq
Collecting pyzmq
  Downloading https://files.pythonhosted.org/packages/16/4c/762c2c3063c4d45baf4a49acea7a4f561f7b78a45cd04b58d63f4c5f6b8d/pyzmq-19.0.0.tar.gz (1.2MB)
     |################################| 1.2MB 384kB/s
Collecting py (from pyzmq)
  Downloading https://files.pythonhosted.org/packages/99/8d/21e1767c009211a62a8e3067280bfce76e89c9f876180308515942304d2d/py-1.8.1-py2.py3-none-any.whl (83kB)
     |################################| 92kB 1.5MB/s
Requirement already satisfied: cffi in c:\users\sakurai\desktop\pypy3.6-v7.3.0-win32\lib_pypy (from pyzmq) (1.13.2)
Installing collected packages: py, pyzmq
  Running setup.py install for pyzmq ... done
Successfully installed py-1.8.1 pyzmq-19.0.0
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\sakurai\Desktop\pypy3.6-v7.3.0-win32>pypy3 -c "import zmq"
_cffi_ext.c
site-packages\zmq\backend\cffi\__pycache__\_cffi_ext.c(56): fatal error C1083: include ファイルを開けません。'sys/un.h':No such file or directory
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\sakurai\Desktop\pypy3.6-v7.3.0-win32\site-packages\zmq\__init__.py", line 47, in <module>
    from zmq import backend
  File "C:\Users\sakurai\Desktop\pypy3.6-v7.3.0-win32\site-packages\zmq\backend\__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "C:\Users\sakurai\Desktop\pypy3.6-v7.3.0-win32\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
    raise value
  File "C:\Users\sakurai\Desktop\pypy3.6-v7.3.0-win32\site-packages\zmq\backend\__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "C:\Users\sakurai\Desktop\pypy3.6-v7.3.0-win32\site-packages\zmq\backend\select.py", line 28, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "C:\Users\sakurai\Desktop\pypy3.6-v7.3.0-win32\site-packages\zmq\backend\cffi\__init__.py", line 6, in <module>
    from zmq.backend.cffi import (constants, error, message, context, socket,
  File "C:\Users\sakurai\Desktop\pypy3.6-v7.3.0-win32\site-packages\zmq\backend\cffi\constants.py", line 4, in <module>
    from ._cffi import C, c_constant_names
  File "C:\Users\sakurai\Desktop\pypy3.6-v7.3.0-win32\site-packages\zmq\backend\cffi\_cffi.py", line 100, in <module>
    "Please check that you have zeromq headers and libraries." % e)
ImportError: PyZMQ CFFI backend couldn't find zeromq: CompileError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
Please check that you have zeromq headers and libraries.

This is still an issue (Windows 10, 64-bit Anaconda downloaded on 2018-11-15).

Workaround proposed by @LauriListak solved the issue.

@LauriListak

I ran into this issue under 64-bit Windows 10 when running jupyter notebook with Anaconda 4.3.1. However, pip uninstall pyzmq and pip install pyzmq did the work for me, even though pip warned me that

+2 … I just solved the same error with this method… thanks…