Python Forum
AttributeError when installing PIP - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: AttributeError when installing PIP (/thread-29691.html)

Pages: 1 2


AttributeError when installing PIP - stevecomp - Sep-16-2020

Hi all,

I'm getting this error when installing pip:

AttributeError: 'module' object has no attribute 'Transport'

I'm on Windows10 using python version 2.7.16 and using get-pip.py (https://bootstrap.pypa.io/get-pip.py)for the installation.

Huh

I'm a bit flumoxed on how to fix this.

Thanks for any advice

S


RE: AttributeError when installing PIP - ndc85430 - Sep-16-2020

First and foremost, why are you using Python 2 at all? It reached end of life at the beginning of the year, so you really should be using version 3.


RE: AttributeError when installing PIP - stevecomp - Sep-16-2020

I work in the VFX industry and alot of the software packages we used have not yet transitioned over to python 3.
So stuck in python 2 for a little while longer


RE: AttributeError when installing PIP - ndc85430 - Sep-16-2020

You shouldn't need to install pip separately though; it's been included in 2.x since 2.7.9, according to the docs.


RE: AttributeError when installing PIP - stevecomp - Sep-16-2020

Yes, thats something I should have mentioned, I thought it was included but when I tried to use it I got an error message.

here's the results from a version check:


C:\Users\STEVE>python --version
Python 2.7.16

C:\Users\STEVE>pip --version
'pip' is not recognized as an internal or external command,
operable program or batch file.


RE: AttributeError when installing PIP - ndc85430 - Sep-16-2020

What about python -m pip --version as per the docs I linked to above?

I'm not a Windows user, so don't know why you don't have pip as a standalone command.


RE: AttributeError when installing PIP - stevecomp - Sep-16-2020

Im getting this with that command:

C:\Users\STEVE>python -m pip --version
C:\Python27\python.exe: No module named pip


RE: AttributeError when installing PIP - ndc85430 - Sep-16-2020

That's odd. Look at the docs I linked to - there's a section titled "Pip not installed". What happens if you try the solution there?


RE: AttributeError when installing PIP - stevecomp - Sep-16-2020

Had a go at that, and the attribute error rears it's ugly head:

C:\Users\STEVE>python -m ensurepip --default-pip
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\lib\ensurepip\__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "C:\Python27\lib\ensurepip\__init__.py", line 219, in _main
default_pip=args.default_pip,
File "C:\Python27\lib\ensurepip\__init__.py", line 123, in _bootstrap
return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "C:\Python27\lib\ensurepip\__init__.py", line 31, in _run_pip
import pip._internal
File "c:\users\steve\appdata\local\temp\tmpoqrpxt\pip-18.1-py2.py3-none-any.whl\pip\_internal\__init__.py", line 40, in <module>

File "c:\users\steve\appdata\local\temp\tmpoqrpxt\pip-18.1-py2.py3-none-any.whl\pip\_internal\cli\autocompletion.py", line 8, in <module>
File "c:\users\steve\appdata\local\temp\tmpoqrpxt\pip-18.1-py2.py3-none-any.whl\pip\_internal\cli\main_parser.py", line 12, in <module>
File "c:\users\steve\appdata\local\temp\tmpoqrpxt\pip-18.1-py2.py3-none-any.whl\pip\_internal\commands\__init__.py", line 6, in <module>

File "c:\users\steve\appdata\local\temp\tmpoqrpxt\pip-18.1-py2.py3-none-any.whl\pip\_internal\commands\completion.py", line 6, in <module>
File "c:\users\steve\appdata\local\temp\tmpoqrpxt\pip-18.1-py2.py3-none-any.whl\pip\_internal\cli\base_command.py", line 18, in <module>
File "c:\users\steve\appdata\local\temp\tmpoqrpxt\pip-18.1-py2.py3-none-any.whl\pip\_internal\download.py", line 771, in <module>
AttributeError: 'module' object has no attribute 'Transport'

Thinking I might try and re-instal python


RE: AttributeError when installing PIP - snippsat - Sep-16-2020

Go to Scripts folder in cmd and test if it's environment Path problem.
When in folder it will use what's in folder and not what set in Windows environment Path.
C:\Users\Tom>cd\
C:\>cd Python27
C:\Python27>cd scripts

C:\Python27\Scripts>pip --version
pip 18.1 from c:\python27\lib\site-packages\pip (python 2.7)
C:\Python27\Scripts>
So Script folder is placement of pip.exe.
I do of course not have 2.7 as main version in Path.
If go to any other folder i will use Python 3.8.
C:\Python27\Scripts>cd ..
C:\Python27>cd ..

C:\>pip --version
pip 20.2.3 from c:\python38\lib\site-packages\pip (python 3.8)
C:\>python --version
Python 3.8.3
Also if have python 3.8 installed then can use py(new in Python 3.3 -->),to access all version from Python.org.
# Use py 
C:\>py -2.7 --version
Python 2.7.9

# Use pip from py
C:\>py -2.7 -m pip install logzero
Requirement already satisfied: colorama; sys_platform == "win32" in c:\python27\
lib\site-packages (from logzero) (0.3.2)