Skip to content

'pip install micropython-machine' failed #438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DesperateForHelpIntern opened this issue Aug 10, 2021 · 14 comments
Closed

'pip install micropython-machine' failed #438

DesperateForHelpIntern opened this issue Aug 10, 2021 · 14 comments

Comments

@DesperateForHelpIntern
Copy link

I ran the pip install command given by the machine main website and this error occured:

ERROR: File "setup.py" not found for legacy project micropython-machine from https://files.pythonhosted.org/packages/e1/31/a3282942b3e96881393db406130735913c647f0fc9e07a0d60d7b546b06b/micropython-machine-0.2.tar.gz#sha256=b8747926ee044547c5f5df09b8015977b4137c744800285ee92f307acc477223.

Interestingly, a very similar error occured when I tried installing upip to install machine. (pip install micropython-upip) returned the following error:

ERROR: File "setup.py" not found for legacy project micropython-upip from https://files.pythonhosted.org/packages/29/81/52df27cb7d240190c1d3ddab0c081bd3296bedcce155eed9e7016c4d92f0/micropython-upip-1.2.6.tar.gz#sha256=b9c09fc2b65f877d945142e468e0f25b5f70e9f74e98e0f43ca030bd7f47e87f.

@DesperateForHelpIntern
Copy link
Author

I tried installing machine again via thonny's package manger and this happened: C:\Users\sawye\AppData\Local\Programs\Thonny\python.exe -m pip install --no-cache-dir --user micropython-machine --disable-pip-version-check

Collecting micropython-machine
Downloading micropython-machine-0.2.tar.gz (1.7 kB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\sawye\AppData\Local\Programs\Thonny\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\sawye\AppData\Local\Temp\pip-install-35eahy63\micropython-machine\setup.py'"'"'; file='"'"'C:\Users\sawye\AppData\Local\Temp\pip-install-35eahy63\micropython-machine\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 'C:\Users\sawye\AppData\Local\Temp\pip-pip-egg-info-4drkjt7o'
cwd: C:\Users\sawye\AppData\Local\Temp\pip-install-35eahy63\micropython-machine
Complete output (5 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\sawye\AppData\Local\Programs\Thonny\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\sawye\AppData\Local\Temp\pip-install-35eahy63\micropython-machine\setup.py'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Process returned with code 1

@hellozepp
Copy link

Same error

@tarekfouad2000
Copy link

tarekfouad2000 commented Jun 15, 2022

same issue here
maybe i am installing it in a wrong way ?

@andrewleech
Copy link
Contributor

andrewleech commented Jun 15, 2022

I'm not sure how thonny is expected to work but currently these packages are not expected to work with pip because that's for cpython, whereas these packages can only be installed in micropython.

The official method I know of currently is to have a micropython built with upip frozen directly into it (or upip.py manually added to current folder / micropython path) then you can micropython -m upip install micropython-machine

Alternatively this tool might help, though I haven't tried it myself: https://pypi.org/project/pipkin/

@tarekfouad2000
Copy link

I'm not sure how thonny is expected to work but currently these packages are not expected to work with pip because that's for cpython, whereas these packages can only be installed in micropython.

The official method I know of currently is to have a micropython built with upip frozen directly into it (or upip.py manually added to current folder / micropython path) then you can micropython -m upip install micropython-machine

Alternatively this tool might help, though I haven't tried it myself: https://pypi.org/project/pipkin/

thank you very much <3

@yatharthb97
Copy link

@tarekfoau Did that solve the issue for you?

@andrewleech
Copy link
Contributor

On a related note, the packaging system for micropython is in the first stages of being overhauled to hopefully resolve issues / confusion like this. For more details you might like to follow micropython/micropython#8914

@yatharthb97
Copy link

yatharthb97 commented Jul 18, 2022

pipkin install micropython-machine broke my env.

Error traceback while I run my code:

Traceback (most recent call last):
File "", line 1, in
File "/lib/machine/init.py", line 2, in
File "/lib/machine/timer.py", line 7, in
File "/lib/signal.py", line 13, in
AttributeError: 'NoneType' object has no attribute 'func'

Does anyone know how to fix this? Reinstalling thonny didn't help.

@andrewleech
Copy link
Contributor

That error is pointing to the libc attribute here being None, so something isn't working with the ffi library in your build of micropython / on your Linux:

signal_i = libc.func("i", "signal", "ii")

What exactly are you trying to do with this machine package? It's only used on the Unix port of micropython and has very few features - on devices the machine module is a built-in.

@yatharthb97
Copy link

I was just testing pipkin. I am using Windows not Unix. Not sure why that is being called. Is there a way to scrub the Microphone completely and start fresh.

@andrewleech
Copy link
Contributor

Yeah ok, pipkin is a third party project that's attempting to make the most out of what's currently on pypi, most of which is old / unmaintained / full of inconsistencies.

To be honest the mechanism for publishing micropython packages to pypi has been broken and unused for a long time, hence the PR I linked earlier about building a new system that doesn't rely on pypi at all and is intended to be far more suitable for micropython users.

Without knowing what/how you've currently installed micropython I can't help much with cleaning it. Any other questions relating to pipkin and what it's installed would be better asked on the pipkin project pages.

@yatharthb97
Copy link

Hey, sorry for the delay. I just installed thonny using pip. Any help would be appreciated.

@andrewleech
Copy link
Contributor

Thonny is also a third party project, I believe it's by the same author as pipkin. I don't use it sorry, you'll need to look up docs/forums/etc for thonny.

As I mentioned earlier there is work being done to fix/improve the official packaging install system (based on manifest files) but I don't know how long it's expected to take.

@dpgeorge
Copy link
Member

dpgeorge commented Oct 4, 2022

upip has been replaced with mip, and the way to install things on the unix port is being reworked to use mip as well.

Otherwise it looks like this is an issue related to thonny/pipkin, so best to raise that issue in the appropriate repository.

@dpgeorge dpgeorge closed this as completed Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants