andy lee
andy lee

Reputation: 37

A problem about install the python package

I want to use rawpy python package. However, our docker is not allowed us to use pip, so I have to add the path of the rawpy.

Accroding to the instructions of our docker, I do these steps as follows:

  1. download the source of rawpy. the link is : https://pypi.org/project/rawpy/#files
    I download the last one and unzip it. I put it in my folder /home/pylib

  2. mount folder -v /home/pylib:/data/pylib

  3. Add the following two lines of code at the beginning of my code:

    import sys; sys.path.insert(1, '/data/pylib')

    1 represents /data/pylib as having priority only lower than the directory in which my codes resides. At this point, the priorities of /data/pylib are higher than the system's own path, and import rawpy will imports rawpy in /data/pylib.

But the rawpy source code have many .cpp files, such as _rawpy.cpp, and I got an error : `ModuleNotFoundError: No module named 'rawpy._rawpy'

It seems rawpy can be used if there exsist _rawpy.py, but there only exsist _rawpy.cpp in the rawpy folder. What can I do?

Upvotes: 0

Views: 521

Answers (1)

AKX
AKX

Reputation: 168824

Rawpy is a Python module with a binary component which needs to be compiled; just downloading the source and plonking it in sys.path won't help (as you've noticed).

Are you absolutely sure you can't use pip, even with the --user flag (so it doesn't require root privileges)?

If that is indeed the case, then you could try to download the suitable manylinux wheel instead, rename the .whl to .zip and use that instead as you've done with /data/pylib etc. The wheel will have the compiled binary extension too.

Upvotes: 3

Related Questions