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.
Related
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?
I'm tyring to use this program (https://github.com/tbabej/uadt) to test my pcap captures and do some machine learning. I use the command git clone to have everything on my pc, then I use "pip -r install requirements.txt" and then I execute "setup.py install".
Then I need to generate my dataset, so I go to /uadt/uadt/analysis/ and run dataset.py as stated in the Readme, but I get the error
from uadt import config
ImportError: cannot import name 'config' from 'uadt'
What am I doing wrong? Is there another way to install it?
I just need the files in the analysis folder because I've already done the other steps on my own.
Traceback (most recent call last):
File "/usr/local/bin/uadt-dataset", line 33, in <module>
sys.exit(load_entry_point('uadt==0.8.0', 'console_scripts', 'uadt-dataset')())
File "/usr/local/bin/uadt-dataset", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/usr/local/lib/python3.9/dist-packages/uadt-0.8.0-py3.9.egg/uadt/analysis/dataset.py", line 26, in <module>
from uadt.analysis.flow import Flow
File "/usr/local/lib/python3.9/dist-packages/uadt-0.8.0-py3.9.egg/uadt/analysis/flow.py", line 13, in <module>
from uadt import config
ImportError: cannot import name 'config' from 'uadt' (/usr/local/lib/python3.9/dist-packages/uadt-0.8.0-py3.9.egg/uadt/__init__.py)
You can copy the config.py.in file into the uadt folder.
This could fix your import issue.
i'm trying to use slicereg (https://github.com/brainglobe/slicereg) for data registration.
after import code from github page and install poetry to run slicereg i keep getting the following error :
The virtual environment found in ~\.conda\envs\sliceregenv seems to be broken.
Recreating virtualenv slicereg-6kSWvOuc-py3.8 in ~\AppData\Local\pypoetry\Cache\virtualenvs\slicereg-6kSWvOuc-py3.8
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "~\.conda\envs\sliceregenv\lib\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 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "~\slicereg\slicereg\main.py", line 3, in <module>
from PySide2.QtWidgets import QApplication
ModuleNotFoundError: No module named 'PySide2'
Pyside2 is already installed in my env using pip.
Any advice on how to resolve this issue ?
Thx
Seems to be an issue, poetry fails to recognize conda environments as valid
see more at https://github.com/python-poetry/poetry/issues/4566
Remain unresolved for the current release (1.1.12)
Update : https://github.com/python-poetry/poetry/issues/5907
I am trying to install the following dependencies:
appdirs==1.4.3
click==6.7
Flask==1.0
itsdangerous==0.24
Jinja2==2.10.1
MarkupSafe==1.0
packaging==16.8
prometheus-client==0.0.19
pyparsing==2.2.0
Werkzeug==0.15.3
But no matter which dependency I try to install I get the following error:
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==19.3', 'console_scripts', 'pip')()
File "/usr/lib/python3.8/site-packages/pip/_internal/main.py", line 45, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/usr/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
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 "/usr/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "/usr/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 28, in <module>
from pip._internal.self_outdated_check import (
File "/usr/lib/python3.8/site-packages/pip/_internal/self_outdated_check.py", line 15, in <module>
from pip._vendor.six import ensure_binary
ImportError: cannot import name 'ensure_binary' from 'six' (/usr/lib/python3.8/site-packages/six.py)
What is the issue?
Posting this answer here specifically for people that use Manjaro Linux (where the use of pip is not recommended as it can break one's environment if not used correctly). It can also result in subsequent distro updates to not happen seamlessly and may result in manual intervention required.
The solution to undo the damage to the environment is to use:
sudo pacman -Syu python-pkgname --overwrite='*'
where pkgname is the name of the python dependency you want to install. After this is done, the environment should be fixed and subsequently it will not be required to apply the --overwrite option.
This whole Python 2 and Python 3 and the resulting pip2 and pip3 tools separation is insane.
I'm trying to get paperless installed, and am running into an issue with dotenv under python. I've some digging, and ended up doing an uninstall of dotenv and then an install of python-dotenv via pip. I'm still running into the same error. Any help would be greatly appreciated!
Traceback (most recent call last):
File "./manage.py", line 18, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 307, in execute
settings.INSTALLED_APPS
File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
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 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/var/www/paperless/paperless/src/paperless/settings.py", line 15, in <module>
from dotenv import load_dotenv
ModuleNotFoundError: No module named 'dotenv'
I'm running
Linux ubuntu 4.13.0-21-generic #24-Ubuntu SMP Mon Dec 18 17:29:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Python 3.6.3
pip install python-dotenv returns Successfully installed python-dotenv-0.8.2
First check for dotenv with 'pip3 list'
install it if not on the list with: 'pip3 install python-dotenv'
Results:
Collecting python-dotenv
Downloading python_dotenv-0.20.0-py3-none-any.whl (17 kB)
Installing collected packages: python-dotenv
Successfully installed python-dotenv-0.20.0