Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

NameError: name 'ensurepip' is not defined #99

Closed
wolfer649 opened this issue Apr 1, 2019 · 18 comments
Closed

NameError: name 'ensurepip' is not defined #99

wolfer649 opened this issue Apr 1, 2019 · 18 comments

Comments

@wolfer649
Copy link

"NameError: name 'ensurepip' is not defined" - msg received when running setup.py.
Platform: Raspberry Pi 3 B with fresh Rasbian Stretch 06-27 install.
Adafruit_Python_GPIO was cloned from github.
Line 1 of setup.py is "ensurepip" which fails with the error message above.
If line 1 is commented out, the script seems to run OK for Python 3 and Python 2.7.
(the "python" command on this version of Stretch defaults to Python 2.7)
BTW, this was the root cause of an error installing the Adafruit MAX31855 software.

@ladyada
Copy link
Member

ladyada commented Apr 2, 2019

@mpratt14 any suggestions?

@ladyada
Copy link
Member

ladyada commented Apr 2, 2019

@RyAndrew
Copy link

RyAndrew commented Apr 2, 2019

This is really bumming me out.
It seems this commit added "ensurepip"
57adb1e#diff-2eeaed663bd0d25b7e608891384b7298

However ensurepip seems to be disabled:
pi@raspberrypi:~ $ python3 -m ensurepip --upgrade
ensurepip is disabled in Debian/Ubuntu for the system python.

@RyAndrew
Copy link

RyAndrew commented Apr 2, 2019

Temporary workaround - install Adafruit_Python_GPIO from the commit before it was broken:
pip install git+git://github.com/adafruit/Adafruit_Python_GPIO@0ec1977df23c0a043f6a53c12aea90ed79782b5d

@mcprat
Copy link
Contributor

mcprat commented Apr 2, 2019

3 things:

Yeah...my bad...I messed up the pull request...
In order for ensurepip to run in a script it has to be imported and called with the bootstrap() method...
I've been testing a lot today and I'm going to pull request to fix my mistakes...

There are some small issues left in the SPI methods that I worked on (there was more before that), also going to push that...this time I made sure I tested everything extensively.... (but I'm not testing on python 3 right now)
So you might not want to use the older version...but it's not hard to remove the .egg and reinstall

you are using python 3 it seems (which, I'm not sure will run this library well or not) so you don't need to worry about ensurepip. I'll have the positive existence of pip handled when I fix the setup.py

@mcprat
Copy link
Contributor

mcprat commented Apr 2, 2019

@ladyada @RyAndrew @wolfer649
Again, very sorry

See my requests #100 #101

should be perfect now

@ladyada
Copy link
Member

ladyada commented Apr 2, 2019

they've been merged, please try!

@RyAndrew
Copy link

RyAndrew commented Apr 2, 2019

thanks seems to be working

@wolfer649
Copy link
Author

wolfer649 commented Apr 2, 2019 via email

@ladyada
Copy link
Member

ladyada commented Apr 2, 2019

this library was never py3 compat - please use please use https://learn.adafruit.com/thermocouple/python-circuitpython :)

@mcprat
Copy link
Contributor

mcprat commented Apr 2, 2019

@ladyada I think you keep linking the wrong thing...
do you mean this?
https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/overview

@wolfer649 No problem, I'm just glad I was able to fix my own mistakes.

I had no idea the incompatibility between the python versions were so extreme!
setup.py should maybe stay that way though...since this is a python 2 library only...

Maybe add that detail to the readme, and then a fully compatible print line to remind the user they should be using python 2.x in setup.py...

Edit: It seems newest libFTDI has ok python 3 support, so in the future making this library compatible might not be too difficult...

@ladyada
Copy link
Member

ladyada commented Apr 2, 2019

im pretty sure im linking to the right thing, its our Blinka-based MAX31855 library, if they follow those steps they'll be good to go :)

@mcprat
Copy link
Contributor

mcprat commented Apr 2, 2019

@ladyada Ah...I looked over the part where @wolfer649 mentioned using the MAX31855.

@wolfer649 which library exactly did you try to install other than this one? or are you using something completely different to run that device? wrote your own?
There's so many of them that look similar....

Is it simply not compatible with python 3 or only the setup.py for that one?

I might have misunderstood, but does this library run well on python 3, at least the sections used for the thermocouple?

I'm guessing you are using this one, which seems to depend on this library
https://github.com/adafruit/Adafruit_Python_MAX31855

If anyone is trying to use CircuitPython for SPI or I2C in general uses / other devices I would start here:
https://learn.adafruit.com/circuitpython-basics-i2c-and-spi/spi-devices
https://circuitpython.readthedocs.io/en/3.x/shared-bindings/busio/SPI.html

@wolfer649
Copy link
Author

wolfer649 commented Apr 2, 2019 via email

@mcprat
Copy link
Contributor

mcprat commented Apr 3, 2019

@wolfer649 Thanks for the full explanation, there's so many things involved I got confused. Looks like it would indeed help you to make the print statements compatible with both so I'll do that right now

@mcprat
Copy link
Contributor

mcprat commented Apr 3, 2019

@ladyada hopefully we are done with setup.py now
the print statements can be removed too, your choice, but this makes them run on both
#102

@ladyada
Copy link
Member

ladyada commented Apr 3, 2019

@mpratt14 awesome, thank you thank you!!!!

@ladyada
Copy link
Member

ladyada commented Sep 30, 2019

hiya thank you for the issue. we're going to be deprecating this library in favor of our python3 Blinka library which has support for almost 200 different drivers, and a wide variety of linux computers as well as ft232h

If this issue is still occuring when you use Blinka, please re-open it there!

@ladyada ladyada closed this as completed Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants