stlehmann / micropython-ssd1306

A fork of the driver for SSD1306 displays to make it installable via upip
MIT License
109 stars 41 forks source link

can't import micropython-ssd1306 #5

Open roblatour opened 2 years ago

roblatour commented 2 years ago

on a raspberry pi, running Bullseye, running Thonny, Tools, Manage Packages, search for SSD1306, try to install micropython-ssd1306 yields the following error:

ERROR: Could not find a version that satisfies the requirement micropython-ssd1306 ERROR: No matching distribution found for micropython-ssd1306 Process returned with code 1

ss1

berrak commented 2 years ago

I can see from the REPL window that you have not micropython configured for a board running micropython? I have a Raspberry Pico board on my computer USB-port (/dev/ttyACM3) running Debian 11, and the installation to the rp2040 worked perfectly, as seen in Thonny (3.3.14) under View->Files, and in the lib folder, I find 'ssd1306.py.'

RockaBen99 commented 1 year ago

I had a similar issue with the same setup. The full error logs are:

/usr/bin/python3 -m pip --disable-pip-version-check --no-color install --no-warn-script-location --user --user micropython-ssd1306 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting micropython-ssd1306 Using cached micropython-ssd1306-0.3.tar.gz (1.8 kB) ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lxd6xaqs/micropython-ssd1306_bb932766351b4cfaa28b910834f81137/setup.py'"'"'; file='"'"'/tmp/pip-install-lxd6xaqs/micropython-ssd1306_bb932766351b4cfaa28b910834f81137/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 /tmp/pip-pip-egg-info-_eu17il2 cwd: /tmp/pip-install-lxd6xaqs/micropython-ssd1306_bb932766351b4cfaa28b910834f81137/ Complete output (5 lines): Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.9/tokenize.py", line 392, in open buffer = _builtin_open(filename, 'rb') FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-lxd6xaqs/micropython-ssd1306_bb932766351b4cfaa28b910834f81137/setup.py'

WARNING: Discarding https://files.pythonhosted.org/packages/01/d0/0841d47772962c80af3ab178ef062ed2cd524cb99eb38463e669428402a8/micropython-ssd1306-0.3.tar.gz#sha256=d00cae1ff680e6ae504e258e700f002874b0d924b1a604253b6ea63144b58289 (from https://pypi.org/simple/micropython-ssd1306/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Using cached micropython-ssd1306-0.2.tar.gz (1.8 kB) ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lxd6xaqs/micropython-ssd1306_31ca10fac1ac40d098e268c4f47cd0e9/setup.py'"'"'; file='"'"'/tmp/pip-install-lxd6xaqs/micropython-ssd1306_31ca10fac1ac40d098e268c4f47cd0e9/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 /tmp/pip-pip-egg-info-kp81tsvd cwd: /tmp/pip-install-lxd6xaqs/micropython-ssd1306_31ca10fac1ac40d098e268c4f47cd0e9/ Complete output (5 lines): Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.9/tokenize.py", line 392, in open buffer = _builtin_open(filename, 'rb') FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-lxd6xaqs/micropython-ssd1306_31ca10fac1ac40d098e268c4f47cd0e9/setup.py'

WARNING: Discarding https://files.pythonhosted.org/packages/4d/2b/de6cd81e86782c87bdfd57066ae917aba453d0f89b54f2080c6d4b150e45/micropython-ssd1306-0.2.tar.gz#sha256=7ac7d446e47df22435be1803cff7ea1973f2117bad47a47798082498e7c88543 (from https://pypi.org/simple/micropython-ssd1306/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Using cached micropython-ssd1306-0.1.tar.gz (342 bytes) ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lxd6xaqs/micropython-ssd1306_c182fd022dfe49ab839ca15709bb6e74/setup.py'"'"'; file='"'"'/tmp/pip-install-lxd6xaqs/micropython-ssd1306_c182fd022dfe49ab839ca15709bb6e74/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 /tmp/pip-pip-egg-info-wac4ckr5 cwd: /tmp/pip-install-lxd6xaqs/micropython-ssd1306_c182fd022dfe49ab839ca15709bb6e74/ Complete output (5 lines): Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.9/tokenize.py", line 392, in open buffer = _builtin_open(filename, 'rb') FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-lxd6xaqs/micropython-ssd1306_c182fd022dfe49ab839ca15709bb6e74/setup.py'

WARNING: Discarding https://files.pythonhosted.org/packages/95/fb/3e02585a3274043e2cd5c98784fc56d8de4803e7a079bacbb54b0925929c/micropython-ssd1306-0.1.tar.gz#sha256=8c1886d053c4d1dcf17bfa83944771b704799e7f485bb75ff1177ab6aaf435e3 (from https://pypi.org/simple/micropython-ssd1306/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement micropython-ssd1306 ERROR: No matching distribution found for micropython-ssd1306 Error: process returned with code 1

The terminal encountered the same error when I tried pip3 install micropython-ssd1306. Possibly it was trying to use a cached version which doesn't exist? However the issue persisted across multiple restarts, which doesn't make sense logically (though I don't know how pip works so this might be normal).

Attempting to install opencv-python (as a test) worked fine, so it is an issue with the library (and possibly something about Raspberry Pi OS), not just my computer.

RockaBen99 commented 1 year ago

I have found the issue, it's a problem on my and @roblatour 's end. I (and presumably roblatour) attempted to use Thonny's plugin manager to install the library rather than the package library. Both install packages from PyPi, but the package manager works with the packages on the microcontroller while the plugin manager deals with those on the computer. micropython-ssd1306 is for micropython installations so can only be installed on one, which Thonny does through the package manager, not the plugin manager.

Temirlan504 commented 1 year ago

Just to share my solution here. What I did is just created a new py file called "ssd1306.py" on my pico and pasteed the code from this github page.

Hope, this will help others