pythonpython-packaging

cannot import name 'PROT_READ' from 'mmap'


I am trying to use pypcie to write a small piece of code,
I have installed the package in vs code using pip, but when I try to run the code it gives me the following error:

Traceback (most recent call last):
  File "c:\Users\'user'\OneDrive\desktop\Git Repos\learnpython_org\pyPCIE_playground.py", line 2, in <module>
    from pypcie import Device
  File "C:\Users\'user'\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pypcie\_init_.py", line 1, in <module>
    from .device import Device
  File "C:\Users\'user'\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pypcie\device.py", line 3, in <module>
    from .bar import Bar
  File "C:\Users\'user'\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pypcie\bar.py", line 3, in <module>
    from mmap import mmap, PROT_READ, PROT_WRITE, PAGESIZE
ImportError: cannot import name 'PROT_READ' from 'mmap' (unknown location)

the line that I have traced this back to is in the pyPCIe package that I have installed

from mmap import mmap, PROT_READ, PROT_WRITE, PAGESIZE

Am I missing a step in setup to use the package properly?
I assumed mmap is a built-in package and not needed to isntall via pip, since when I try to run

pip install mmap

it returns Could not find a version that satisfies the requirement mmap


Solution

  • The pyPCIe package you're trying to use will only work on Linux, as you can see in the classifiers list on its PyPI page.

    You're evidently on Windows, so that package will not work.