Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

[Bugfix] When execute the script "pip-diff", occur Error "ImportError: No module named 'pip.index'". #18

Closed
wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 1, 2018

======[Basic Info]======
=[Bug Info]=:
When execute the script "pip-diff", occur Error "ImportError: No module named 'pip.index'".
=[Bugfix Solution]=:
This question is caused by the new version of "pip"(>10.0) modifying the directory structure. and there is a dir named "_internal". So add a logical code to solve it.

======[Bugfix Test Result]======
=[Bug Running Log as following]=

F:\0Devin_2018\CodeProject\Python\PursuitSmallCode\venv\Scripts\python.exe "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 50787 --file F:/0Devin_2018/CodeProject/Python/pip-pop/bin/pip-diff --stale ..\tests\test-requirements.txt ..\tests\test-requirements2.txt
pydev debugger: process 5032 is connecting

Connected to pydev debugger (build 181.5087.37)
Traceback (most recent call last):
File "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py", line 1664, in
main()
File "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "F:/0Devin_2018/CodeProject/Python/pip-pop/bin/pip-diff", line 23, in
from pip.req import parse_requirements
ImportError: No module named 'pip.req'

=[Bugfix Running Result as following]=
F:\0Devin_2018\CodeProject\Python\PursuitSmallCode\venv\Scripts\python.exe "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 50780 --file F:/0Devin_2018/CodeProject/Python/pip-pop/bin/pip-diff --stale ..\tests\test-requirements.txt ..\tests\test-requirements2.txt
pydev debugger: process 5576 is connecting

Connected to pydev debugger (build 181.5087.37)
cffi
django

Process finished with exit code 0

Signed-off-by: Devin [email protected]

=[Bug Info]=:
When execute the script "pip-diff", occur Error "ImportError: No module named 'pip.index'".
=[Bugfix Solution]=:
This question is caused by the new version of "pip"(>10.0) modifying the directory structure. and there is a dir named "_internal". So add a logical code to solve it.

======[Bugfix Test Result]======
=[Bug Running Log as following]=

F:\0Devin_2018\CodeProject\Python\PursuitSmallCode\venv\Scripts\python.exe "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 50787 --file F:/0Devin_2018/CodeProject/Python/pip-pop/bin/pip-diff --stale ..\tests\test-requirements.txt ..\tests\test-requirements2.txt
pydev debugger: process 5032 is connecting

Connected to pydev debugger (build 181.5087.37)
Traceback (most recent call last):
  File "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py", line 1664, in <module>
    main()
  File "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py", line 1658, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py", line 1068, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "F:/0Devin_2018/CodeProject/Python/pip-pop/bin/pip-diff", line 23, in <module>
    from pip.req import parse_requirements
ImportError: No module named 'pip.req'

=[Bugfix Running Result as following]=
F:\0Devin_2018\CodeProject\Python\PursuitSmallCode\venv\Scripts\python.exe "F:\Program Files\PyCharm Community Edition 2018.1.4\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 50780 --file F:/0Devin_2018/CodeProject/Python/pip-pop/bin/pip-diff --stale ..\tests\test-requirements.txt ..\tests\test-requirements2.txt
pydev debugger: process 5576 is connecting

Connected to pydev debugger (build 181.5087.37)
cffi
django

Process finished with exit code 0
=========================================

Signed-off-by: Devin <[email protected]>
@ghost ghost mentioned this pull request Jul 1, 2018
@jayvdb
Copy link

jayvdb commented Dec 12, 2019

@chaolinyi , this fails on pip 19. I suggest using https://github.com/sarugaku/pip-shims to be future proof.

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants