简体   繁体   中英

Unable to install python3 package via pip

I am currently moving from Python 2 to Python 3, and I found that one of the packages that I use is currently in Python3 only through a pull-request .

So, I decided to checkout the repository, and checkout the pull-request. I checked and this pull-request only updates a .py file which contains all the coding for the package.

Then, I tried to install the package (being on my computer locally) with pip:

python .\Scripts\pip3.exe install --upgrade --no-index --find-links=. C:\Users\DASTe\PycharmProjects\pyosc

However, I'm getting the following error:

Looking in links: .
Processing c:\users\date\pycharmprojects\pyosc
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\DASTe\PycharmProjects\DASTeNer\server_py3\python_win32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\DASTe\\AppData\\Local\\Temp\\pip-req-build-xhcdcl8u\\setup.py'"'"'; __file__='"'"'C:\\Users\\DASTe\\AppData\\Local\\Temp\\pip-req-build-xhcdcl8u\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:\Users\DASTe\AppData\Local\Temp\pip-req-build-xhcdcl8u\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\DASTe\AppData\Local\Temp\pip-req-build-xhcdcl8u\setup.py", line 5, in <module>
        import OSC
    ModuleNotFoundError: No module named 'OSC'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

This happens in the setup.py file from the package. I have googled, and it appears that in Python 3, the relative imports are done using from . import OSC from . import OSC . However, when I switch that line from setup.py , I get another error:

File "C:\Users\DASTe\AppData\Local\Temp\pip-req-build-7g6v4fwu\setup.py", line 5, in <module>
        from . import OSC
    ImportError: cannot import name 'OSC' from '__main__' (C:\Users\DASTe\AppData\Local\Temp\pip-req-build-7g6v4fwu\setup.py)

Any clue, please?

Many thanks!

It looks like this library has not been maintained since 2011. The pull-request you linked has not been reviewed.

In the short term, I would remove the line import OSC from setup.py and replace OSC.version with ("0.3","6", "$Rev: 6382 $"[6:-2]) , see if it works.

In the long term, I think you will have to take over maintaining this project yourself if you want to keep using it.

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