Unable to get gthub packages to import in python code - python

https://github.com/Miker2808/PyRoboteq
I am trying to use this github package for motor control of a robot. I have been unable to get it to work in vscode, and have tried a few different ways of installing the package. I thought there was something wrong with the package, but I tried to use the same way to install a known package like flask, yet I still get the error below when trying to install the package.
I tried pip3 install (package), that ran correctly and it showed up when I ran pip freeze, but I was unable to import the package in my code.
Here is the error i got when trying to install flask:
sudo pip3 install -e git+https://github.com/pallets/flask#egg=flask
Obtaining flask from git+https://github.com/pallets/flask#egg=flask
Cloning https://github.com/pallets/flask to ./src/flask
Running command git clone -q https://github.com/pallets/flask /home/chase/src/flask
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/chase/src/flask/setup.py'"'"'; __file__='"'"'/home/chase/src/flask/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info
cwd: /home/chase/src/flask/
Complete output (35 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/chase/src/flask/setup.py", line 4, in <module>
setup(
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/distutils/core.py", line 121, in setup
dist.parse_config_files()
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 701, in parse_config_files
parse_configuration(self, self.command_options,
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 121, in parse_configuration
meta.parse()
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 426, in parse
section_parser_method(section_options)
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 399, in parse_section
self[name] = value
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 184, in __setitem__
value = parser(value)
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 515, in _parse_version
version = self._parse_attr(value, self.package_dir)
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 349, in _parse_attr
module = import_module(module_name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/chase/src/flask/src/flask/__init__.py", line 4, in <module>
from . import json as json
File "/home/user/src/flask/src/flask/json/__init__.py", line 6, in <module>
from jinja2.utils import htmlsafe_json_dumps as _jinja_htmlsafe_dumps
ModuleNotFoundError: No module named 'jinja2'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Do I have to change something in vscode so it can access the packages I installed?
I tried multiple weays of installing package, unable to use the package anyway.

Related

Gradio cannot install

I tried several ways to install gradio. But it gives this error every time. I can't install it. What could be the solution?
C:\Users\ugurn>pip install gradio
Collecting gradio
Using cached gradio-3.15.0-py3-none-any.whl (13.8 MB)
Collecting python-multipart
Using cached python-multipart-0.0.5.tar.gz (32 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [34 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\ugurn\AppData\Local\Temp\pip-install-z61k1lxd\python-multipart_8b04b9f47ece46d0a012ed3b3c3183cb\setup.py", line 19, in <module>
setup(name='python-multipart',
File "C:\Users\ugurn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "C:\Users\ugurn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\core.py", line 147, in setup
_setup_distribution = dist = klass(attrs)
File "C:\Users\ugurn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 475, in __init__
_Distribution.__init__(
File "C:\Users\ugurn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\_distutils\dist.py", line 283, in __init__
self.finalize_options()
File "C:\Users\ugurn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 898, in finalize_options
for ep in sorted(loaded, key=by_order):
File "C:\Users\ugurn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\setuptools\dist.py", line 897, in <lambda>
loaded = map(lambda e: e.load(), filtered)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\importlib\metadata\__init__.py", line 171, in load
module = import_module(match.group('module'))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\ugurn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\py2app\build_app.py", line 37, in <module>
from py2app.create_appbundle import create_appbundle
File "C:\Users\ugurn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\py2app\create_appbundle.py", line 9, in <module>
from py2app.util import make_exec, makedirs, mergecopy, mergetree, skipscm
File "C:\Users\ugurn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\py2app\util.py", line 5, in <module>
import fcntl
ModuleNotFoundError: No module named 'fcntl'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I want to install Gradio without any problem
The problem is not related to gradio. You have installed py2app on your Windows but https://pypi.org/project/py2app/ is only for Mac OS X. Uninstall py2app:
pip uninstall -y py2app
or remove the directory C:\Users\ugurn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\py2app

Building Flask server - installation error code 1 (MarkupSafe-python setup.py egg_info)

First of all, I run on Python3.6 and trying to install Flask 1.1x.
(I don't wanna upgrade Python)
So, I'm into the active environment venv folder trying to install Flask 1.1x (apparently is the only one that can run on Python3.6).
The error is always the same:
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-ez13kjkb/MarkupSafe/setup.py", line 61, in <module>
run_setup(True)
File "/tmp/pip-build-ez13kjkb/MarkupSafe/setup.py", line 44, in run_setup
ext_modules=ext_modules if with_binary else [],
File "/home/deeman/server/venv/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 121, in setup
dist.parse_config_files()
File "/home/deeman/server/venv/lib/python3.6/site-packages/setuptools/dist.py", line 494, in parse_config_files
ignore_option_errors=ignore_option_errors)
File "/home/deeman/server/venv/lib/python3.6/site-packages/setuptools/config.py", line 106, in parse_configuration
meta.parse()
File "/home/deeman/server/venv/lib/python3.6/site-packages/setuptools/config.py", line 382, in parse
section_parser_method(section_options)
File "/home/deeman/server/venv/lib/python3.6/site-packages/setuptools/config.py", line 355, in parse_section
self[name] = value
File "/home/deeman/server/venv/lib/python3.6/site-packages/setuptools/config.py", line 173, in __setitem__
value = parser(value)
File "/home/deeman/server/venv/lib/python3.6/site-packages/setuptools/config.py", line 430, in _parse_version
version = self._parse_attr(value)
File "/home/deeman/server/venv/lib/python3.6/site-packages/setuptools/config.py", line 305, in _parse_attr
module = import_module(module_name)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'markupsafe'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ez13kjkb/MarkupSafe/
What can I do to fix this, any ideas? Thanks
upgrading pip sort out my problem python -m pip install --upgrade pip

Issue with virtualenv/mkvirtualenv/pip - "zsh: /usr/local/bin/pip: bad interpreter: /usr/local/opt/python#2/bin/python2.7: no such file or directory"

I'm trying to create a new virtualenvironment for some repos but seem to be running into a bunch if issues in my terminal, these are the errors I get:
zsh: /usr/local/bin/pip: bad interpreter: /usr/local/opt/python#2/bin/python2.7: no such file or directory
OR this issue:
ERROR: It thinks sys.prefix is '/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7' (should be '/Users/USERNAME_HERE/.virtualenvs/returns-backend')
ERROR: virtualenv is not compatible with this system or executable
I get this error when running: brew link --overwrite python from here
Linking /usr/local/Cellar/python/3.7.7... Error: Cannot link python
Another version is already linked: /usr/local/Cellar/python/3.7.6_1
I also get this issue when running the following command: pip3 install --upgrade pip from this comment
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 11, in <module>
load_entry_point('pip==19.3.1', 'console_scripts', 'pip3')()
File "/usr/local/lib/python3.7/site-packages/pip/_internal/main.py", line 45, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 23, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "/usr/local/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 17, in <module>
from pip._internal.index import PackageFinder
ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/usr/local/lib/python3.7/site-packages/pip/_internal/index/__init__.py)
I haven't touched the terminal in a long time (2+ years) and don't remember what I used to set these up as my documentation wasn't great last time when starting to code. I think I remember using brew before to set this stuff all up, but now I'm just worried about making any more changes that might break things even further.
Any help with commands that might not be as intrusive/possibly making this problem bigger?

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. While i install misp-modules

ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6mujq2si/pytesseract/setup.py'"'"'; file='"'"'/tmp/pip-install-6mujq2si/pytesseract/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-install-6mujq2si/pytesseract/pip-egg-info
cwd: /tmp/pip-install-6mujq2si/pytesseract/
Complete output (42 lines):
Traceback (most recent call last):
File "/tmp/pip-install-6mujq2si/pytesseract/pytesseract/pytesseract.py", line 26, in
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-6mujq2si/pytesseract/setup.py", line 4, in <module>
setup()
File "/usr/local/lib/python3.8/dist-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/distutils/core.py", line 121, in setup
dist.parse_config_files()
File "/usr/local/lib/python3.8/dist-packages/setuptools/dist.py", line 701, in parse_config_files
parse_configuration(self, self.command_options,
File "/usr/local/lib/python3.8/dist-packages/setuptools/config.py", line 121, in parse_configuration
meta.parse()
File "/usr/local/lib/python3.8/dist-packages/setuptools/config.py", line 426, in parse
section_parser_method(section_options)
File "/usr/local/lib/python3.8/dist-packages/setuptools/config.py", line 399, in parse_section
self[name] = value
File "/usr/local/lib/python3.8/dist-packages/setuptools/config.py", line 184, in __setitem__
value = parser(value)
File "/usr/local/lib/python3.8/dist-packages/setuptools/config.py", line 515, in _parse_version
version = self._parse_attr(value, self.package_dir)
File "/usr/local/lib/python3.8/dist-packages/setuptools/config.py", line 349, in _parse_attr
module = import_module(module_name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/tmp/pip-install-6mujq2si/pytesseract/pytesseract/__init__.py", line 2, in <module>
from .pytesseract import ALTONotSupported
File "/tmp/pip-install-6mujq2si/pytesseract/pytesseract/pytesseract.py", line 28, in <module>
import Image
ModuleNotFoundError: No module named 'Image'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Plz try this :
sudo apt-get install libpq-dev
if it doesn't work plz try this :
sudo apt-get install libpq-dev python-dev

How to resolve python dependency version

I tried running a python script which uses matplotlib. I got following error:
Traceback (most recent call last):
File "q3.py", line 6, in <module>
matplotlib.use('TkAgg')
File "/home/raj/raj/venvs/notes-bash-venv/lib/python3.8/site-packages/matplotlib/__init__.py", line 1162, in use
plt.switch_backend(name)
File "/home/raj/raj/venvs/notes-bash-venv/lib/python3.8/site-packages/matplotlib/pyplot.py", line 276, in switch_backend
class backend_mod(matplotlib.backend_bases._Backend):
File "/home/raj/raj/venvs/notes-bash-venv/lib/python3.8/site-packages/matplotlib/pyplot.py", line 277, in backend_mod
locals().update(vars(importlib.import_module(backend_name)))
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/raj/raj/venvs/notes-bash-venv/lib/python3.8/site-packages/matplotlib/backends/backend_tkagg.py", line 1, in <module>
from . import _backend_tk
File "/home/raj/raj/venvs/notes-bash-venv/lib/python3.8/site-packages/matplotlib/backends/_backend_tk.py", line 6, in <module>
import tkinter as tk
ModuleNotFoundError: No module named 'tkinter'
So I tried installing tkinter:
$ pip3 install tkinter
ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter
What cound be wrong? For the same script, I installed numpy, pandas and matplotlib using command like pip3 install numpy. I am on python 3.8.2 and pip-20.2.3. Also I am on Ubuntu 20.04 on WSL2.
Did you try to install dependencies for Tkinter systemwide?:
sudo apt-get install python3-tk
You may resolve it by using this command OS-wide:
sudo apt install python3-tk
Check it out and let me know if it works.

Categories

Resources