简体   繁体   中英

Trouble installing ZeroMQ / pyzmq in Windows, using pip

I'm kinda new to python and I'm using pip to install packages via console. Worked well with previous installs, but when I try to install pyzmq I receive an error message. I thought the problem was realted to Cython (since I've previously seen something like that), but then I installed Cython and the problem persists. This is the full message I get:

    Collecting pyzmq
      Using cached https://files.pythonhosted.org/packages/7a/d2/1eb3a994374802b352d4911f3317313a5b4ea786bc830cc5e343dad9b06d/pyzmq-18.1.0.tar.gz
    Building wheels for collected packages: pyzmq
      Building wheel for pyzmq (setup.py) ... error
    ERROR: Command errored out with exit status 1:
       command: 'C:\Users\gianf\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"'; __file__='"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\gianf\AppData\Local\Temp\pip-wheel-hxgsq9q7' --python-tag cp38
           cwd: C:\Users\gianf\AppData\Local\Temp\pip-install-7scmlplo\pyzmq\
      Complete output (191 lines):
      running bdist_wheel
      running build
      running build_py
      Generating grammar tables from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\Grammar.txt
      Writing grammar tables to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\Grammar3.8.0.final.0.pickle
      Writing failed: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\\lib\\lib2to3\\Grammar3.8.0.final.0.pickle'
      Generating grammar tables from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\PatternGrammar.txt
      Writing grammar tables to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\PatternGrammar3.8.0.final.0.pickle
      Writing failed: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\\lib\\lib2to3\\PatternGrammar3.8.0.final.0.pickle'
      creating build
(((copying / creating a bunch of stuff I omitted to fit on the post)))
      copying zmq\utils\zmq_constants.h -> build\lib.win-amd64-3.8\zmq\utils
      running build_ext
      running configure
      {'libraries': ['libzmq'], 'include_dirs': [], 'library_dirs': [], 'runtime_library_dirs': [], 'extra_link_args': []}
      Warning: Couldn't find an acceptable libzmq on the system.

      If you expected pyzmq to link against an installed libzmq, please check to make sure:

          * You have a C compiler installed
          * A development version of Python is installed (including headers)
          * A development version of ZMQ >= 3.2 is installed (including headers)
          * If ZMQ is not in a default location, supply the argument --zmq=<path>
          * If you did recently install ZMQ to a default location,
            try rebuilding the ld cache with `sudo ldconfig`
            or specify zmq's location with `--zmq=/usr/local`

      You can skip all this detection/waiting nonsense if you know
      you want pyzmq to bundle libzmq as an extension by passing:

          `--zmq=bundled`

      I will now try to build libzmq as a Python extension
      unless you interrupt me (^C) in the next 10 seconds...

      ************************************************
       1...
      Using bundled libzmq
      already have bundled\zeromq
      staging platform.hpp from: C:\Users\gianf\AppData\Local\Temp\pip-install-7scmlplo\pyzmq\buildutils\include_win32
      error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
      ************************************************
      ----------------------------------------
      ERROR: Failed building wheel for pyzmq
      Running setup.py clean for pyzmq
    Failed to build pyzmq
    Installing collected packages: pyzmq
        Running setup.py install for pyzmq ... error
        ERROR: Command errored out with exit status 1:
         command: 'C:\Users\gianf\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"'; __file__='"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\gianf\AppData\Local\Temp\pip-record-7kjkoe_6\install-record.txt' --single-version-externally-managed --compile --user --prefix=
             cwd: C:\Users\gianf\AppData\Local\Temp\pip-install-7scmlplo\pyzmq\
        Complete output (193 lines):
        running install
        running build
        running build_py
        Generating grammar tables from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\Grammar.txt
        Writing grammar tables to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\Grammar3.8.0.final.0.pickle
        Writing failed: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\\lib\\lib2to3\\Grammar3.8.0.final.0.pickle'
        Generating grammar tables from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\PatternGrammar.txt
        Writing grammar tables to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\PatternGrammar3.8.0.final.0.pickle
        Writing failed: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\\lib\\lib2to3\\PatternGrammar3.8.0.final.0.pickle'
(((copying / creating a bunch of lines I omitted to fit on the post)))
        running build_ext
        running configure
        {'libraries': ['libzmq'], 'include_dirs': [], 'library_dirs': [], 'runtime_library_dirs': [], 'extra_link_args': []}
        Warning: Couldn't find an acceptable libzmq on the system.

        If you expected pyzmq to link against an installed libzmq, please check to make sure:

            * You have a C compiler installed
            * A development version of Python is installed (including headers)
            * A development version of ZMQ >= 3.2 is installed (including headers)
            * If ZMQ is not in a default location, supply the argument --zmq=<path>
            * If you did recently install ZMQ to a default location,
              try rebuilding the ld cache with `sudo ldconfig`
              or specify zmq's location with `--zmq=/usr/local`

        You can skip all this detection/waiting nonsense if you know
        you want pyzmq to bundle libzmq as an extension by passing:

            `--zmq=bundled`

        I will now try to build libzmq as a Python extension
        unless you interrupt me (^C) in the next 10 seconds...

         1...
        Using bundled libzmq
        already have bundled\zeromq
        already have platform.hpp
        building 'zmq.libzmq' extension
        error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
        ----------------------------------------
    ERROR: Command errored out with exit status 1: 'C:\Users\gianf\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"'; __file__='"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\gianf\AppData\Local\Temp\pip-record-7kjkoe_6\install-record.txt' --single-version-externally-managed --compile --user --prefix= Check the logs for full command output.

Since I've noticed an error about MS C++, I downloaded and installed basically everything I could related to Microsoft visual C++, but the error persists.

Also tried to install pyzmq via the msi file, but I'm not sure about the correct path.

https://i.stack.imgur.com/70SUb.jpg

I figured it out!

I installed Visual Studio, but that was not enough. I needed the Build Tools too, more specifically, everything that had "C++" on the optional packages during the install. After that I could install the packages with no problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM