i've installed debian 10.0.4 yesterday on my pc.
it had python version 3.7.3 installed on it , so i tried to update it to version 3.8.3 and now i have version 3.8.3 installed but when i try to install pip using the official get-pip.py it throws an exception . the details is :
Traceback (most recent call last):
File "<frozen zipimport>", line 520, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen zipimport>", line 520, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen zipimport>", line 568, in _get_data
File "<frozen zipimport>", line 523, in _get_decompress_func
zipimport.ZipImportError: can't decompress data; zlib not available
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "get-pip.py", line 23484, in <module>
main()
File "get-pip.py", line 198, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
from pip._internal.cli.main import main as pip_entry_point
File "<frozen zipimport>", line 241, in load_module
File "<frozen zipimport>", line 709, in _get_module_code
File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
i must mention that the python (python2.7) and pip for python 2.7 is working , and i tried to reinstall python using source compilation and i got another error while installing it (zlib error)
Installing Python 3.8 on Debian 10
Building Python 3.8 on Debian is a relatively straightforward process and will only take a few minutes.
Start by installing the packages necessary to build Python source:
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev liblzma-dev
Download the latest release’s source code from the Python download page with wget or curl. At the time of writing this article, the latest release is 3.8.2:
curl -O https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz
When the download is complete, extract the tarball:
tar -xf Python-3.8.2.tar.xz
Navigate to the Python source directory and run the configure script:
cd Python-3.8.2
./configure --enable-optimizations --enable-loadable-sqlite-extensions
The script performs a number of checks to make sure all of the dependencies on your system are present. The --enable-optimizations option will optimize the Python binary by running multiple tests, which will make the build process slower.
Run make to start the build process:
make -j 4
Modify the -j to correspond to the number of cores in your processor. You can find the number by typing nproc.
Once the build is done, install the Python binaries by running the following command as a user with sudo access:
sudo make altinstall
Do not use the standard make install as it will overwrite the default system python3 binary.
At this point, Python 3.8 is installed on your Debian system and ready to be used. You can verify it by typing:
python3.8 --version
Python 3.8.2
source: https://linuxize.com/post/how-to-install-python-3-8-on-debian-10/
Related
For some reasons, I was installing python packages using sudo pip for python3.6 back in my Ubuntu 18.04. I recently upgraded ubuntu version to 20.04 which comes with python3.8 which I want to continue with. Therefore, now, my system has three python versions - 2.7, 3.6, 3.8.
$ pip -V
pip 20.2.3 from /usr/local/lib/python2.7/dist-packages/pip-21.0.1-py2.7.egg/pip (python 2.7)
$ pip3 -V
pip 20.3.4 from /home/dell/.local/lib/python3.8/site-packages/pip (python 3.8)
$ python -V
2.7.18
$ python3 -V
Python 3.8.10
But whenever I install python packages using pip3, it shows the following error -
$ pip3 install numpy
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow 2.4.1 requires numpy~=1.19.2, but you have numpy 1.22.0 which is incompatible.
Successfully installed numpy-1.22.0
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/shutil.py", line 791, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/tmp/pip-target-x7bedgtq/lib/python/numpy-1.22.0.dist-info' -> '/usr/local/lib/python3.6/dist-packages/numpy-1.22.0.dist-info'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dell/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
status = self.run(options, args)
File "/home/dell/.local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
return func(self, options, args)
File "/home/dell/.local/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 453, in run
self._handle_target_dir(
File "/home/dell/.local/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 510, in _handle_target_dir
shutil.move(
File "/usr/lib/python3.8/shutil.py", line 807, in move
copytree(src, real_dst, copy_function=copy_function,
File "/usr/lib/python3.8/shutil.py", line 557, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
File "/usr/lib/python3.8/shutil.py", line 458, in _copytree
os.makedirs(dst, exist_ok=dirs_exist_ok)
File "/usr/lib/python3.8/os.py", line 223, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/numpy-1.22.0.dist-info'
It is somehow pointing to python3.6 numpy package which I installed using sudo pip. How can I solve this? Is there anyway that python3.6 packages can be unblocked from sudo access?
Or will it be fine to uninstall all the packages in '/usr/local/lib/python3.6/dist-packages/'?
EDIT for #psarka comment,
$ sudo python3.6 -m pip uninstall numpy
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pip/__main__.py", line 16, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 19, in <module>
from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils.util'
This is not a direct answer to your question, as you are doing things the wrong way, and facing the direct consequences of doing things the wrong way. So stop, and use venv! :)
cd my_project
python3.8 -m venv venv
source venv/bin/activate
pip install whatever
If you don't have python3.8-venv, install it:
sudo apt install python3.8-venv
Hey I have installed latest python 3.10 and pip3 on my linux (Zorin os lite 15.3 X64) machine but whenever I try to use any pip3 command I get following error
For example I use the command:
pip3 freeze
I get the following error:
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 22, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 73, in <module>
vendored("pkg_resources")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 33, in vendored
__import__(modulename, globals(), locals(), level=0)
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 77, in <module>
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/packaging/requirements.py", line 9, in <module>
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 672, in _load_unlocked
File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/extern/__init__.py", line 43, in load_module
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/pyparsing.py", line 943, in <module>
AttributeError: module 'collections' has no attribute 'MutableMapping'
This was working fine with python 3.9 but when I updated to 3.10 I started getting this error. How can I solve this?
The problem is caused by an old version of pyparsing that has been vendored into pkg_resources, which is now part of setuptools.
I think if you install an updated setuptools, things will run better:
python -m pip install -U setuptools
EDIT - After installing my own version of 3.10.1 on Ubuntu 18.04, I am having this same issue. And the broken pkg_resources is preventing doing any updates, so your classic Catch-22. To begin chasing down a resolution, I've submitted a ticket on the setuptools Github repo.
EDIT2 - Based on aid on the setuptools GitHub repo, I did the following steps:
# add deadsnake repo (default or nightly)
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.10
git clone https://github.com/pypa/setuptools.git && cd setuptools && sudo python3.10 setup.py install
sudo apt install python3.10-distutils
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
sudo apt install python3.10-venv
At this point, I am able to run pip in Python3.10, and create venvs using python3.10 -m venv virtualenv-dir.
update pip using code bellow
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
I can try to fix it with pip install request --upgrade
Update pip...collections.MutableMapping has become collections.abc.MutableMapping.
I have been learning Ansible on Windows 10 through WSL (using Pengwin, a Debian-based Linux) and it's been working fine up until last night. This morning, it's as though it doesn't exist any more:
❯ ansible
Traceback (most recent call last):
File "/usr/bin/ansible", line 34, in <module>
from ansible import context
ModuleNotFoundError: No module named 'ansible'
Literally nothing has changed since last night. Even my computer has remained on. The only difference is that I had logged out of my terminal program.
I tried running pengwin-setup to re-install Ansible, but the issue persists.
Finally, I tried installing it via the instructions on Ansible's own site. However, things got even worse:
❯ sudo apt install software-properties-common
[sudo] password for sturm:
Reading package lists... Done
Building dependency tree
Reading state information... Done
software-properties-common is already the newest version (0.96.20.2-2.1).
0 upgraded, 0 newly installed, 0 to remove and 85 not upgraded.
❯ sudo apt-add-repository --yes --update ppa:ansible/ansible
gpg: keybox '/tmp/tmpg2r1t8x7/pubring.gpg' created
gpg: /tmp/tmpg2r1t8x7/trustdb.gpg: trustdb created
gpg: key 93C4A3FD7BB9C367: public key "Launchpad PPA for Ansible, Inc." imported
gpg: Total number processed: 1
gpg: imported: 1
gpg: no valid OpenPGP data found.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 688, in addkey_func
func(**kwargs)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 386, in add_key
return apsk.add_ppa_signing_key()
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 273, in add_ppa_signing_key
cleanup(tmp_keyring_dir)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 234, in cleanup
shutil.rmtree(tmp_keyring_dir)
File "/usr/lib/python3.8/shutil.py", line 715, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.8/shutil.py", line 672, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.8/shutil.py", line 670, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apt/cache.py", line 570, in update
res = self._cache.update(fetch_progress, slist,
apt_pkg.Error: E:The repository 'http://ppa.launchpad.net/ansible/ansible/ubuntu groovy Release' does not have a Release file.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/apt-add-repository", line 168, in <module>
if not sp.add_source_from_shortcut(shortcut, options.enable_source):
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 759, in add_source_from_shortcut
cache.update(sources_list=new_debsrc_entry.file)
File "/usr/lib/python3/dist-packages/apt/cache.py", line 573, in update
raise FetchFailedException(e)
apt.cache.FetchFailedException: E:The repository 'http://ppa.launchpad.net/ansible/ansible/ubuntu groovy Release' does not have a Release file.
Now I'm out of options. How can I get Ansible running again?
Your issue is coming from the fact that you are using the instructions to install Ansible on an Ubuntu distribution, when, as you stated it, Pengwin is a Debian based one.
So you should use the chapter on how to install Ansible on Debian and not how to install Ansible on Ubuntu.
Better, still, because Pengwin is a very particular distribution, since it is a WSL one, you might want to try the installation via pip:
Ansible can be installed with pip, the Python package manager. If
pip isn’t already available on your system of Python, run the
following commands to install it:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py --user
Then install Ansible:
$ pip install --user ansible
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-with-pip
I try to install a package in Windows 10 (mingw64) and get this error:
IEUser#MSEDGEWIN10 MINGW64 /c/Users/IEUser/PycharmProjects/myapp_msi-msys/myapp_msi
$ pip install -e git+https://source.example.lan:40443/repos/myapp_common#egg=myapp_common
Obtaining myapp_common from git+https://source.example.lan:40443/repos/myapp_common#egg=myapp_common
Cloning https://source.example.lan:40443/repos/myapp_common to c:/users/ieuser/pycharmprojects/myapp_msi-msys/myapp_msi/src/myapp-common
Username for 'https://source.example.lan:40443':
Password for 'https://tguettler#source.example.lan:40443':
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:/msys64/mingw64/lib/python2.7/site-packages/setuptools/__init__.py", line 191, in <module>
monkey.patch_all()
File "C:/msys64/mingw64/lib/python2.7/site-packages/setuptools/monkey.py", line 101, in patch_all
patch_for_msvc_specialized_compiler()
File "C:/msys64/mingw64/lib/python2.7/site-packages/setuptools/monkey.py", line 164, in patch_for_msvc_specialized_compiler
patch_func(*msvc9('find_vcvarsall'))
File "C:/msys64/mingw64/lib/python2.7/site-packages/setuptools/monkey.py", line 151, in patch_params
mod = import_module(mod_name)
File "C:/msys64/mingw64/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "C:/msys64/mingw64/lib/python2.7/distutils/msvc9compiler.py", line 306, in <module>
raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module
What can I do to fix this?
I was following these instructions to set up my development environment: https://www.gtk.org/download/windows.php
Update
Just for the records, I switched from gtk to qt (PySide2) and now I can use the default Python for windows. Everything is much easier now.
In MSYS2, many of the issues are patched downstream with the MINGW-packages that go in to the pacman repository. In this case, the reason you are getting this error is that you have setuptools pip installed, instead of installed using the pacman repository. To fix this issue:
pip uninstall setuptools
pacman -S mingw-w64-x86_64-python-setuptools
or if you are using modern Python:
pip3 uninstall setuptools
pacman -S mingw-w64-x86_x64-python3-setuptools
I'm have installed Trac on Ubuntu 14.04.1 using the following command:
$ sudo apt-get install trac trac-accountmanager trac-graphviz trac-icalviewplugin trac-
mastertickets trac-wysiwyg trac-wikitablemacro trac-tags trac-customfieldadmin trac-
datefieldplugin
This I believe has install Trac 1.0.1-2, but when I run a simple command such as:
$ sudo trac-admin --version
I get the following trace:
Traceback (most recent call last):
File "/usr/bin/trac-admin", line 9, in <module>
load_entry_point('Trac==1.0.1', 'console_scripts', 'trac-admin')()
File "/usr/lib/python2.7/dist-packages/trac/admin/console.py", line 567, in run
translation.activate(locale)
File "/usr/lib/python2.7/dist-packages/trac/util/translation.py", line 325, in activate
translations.activate(locale, env_path)
File "/usr/lib/python2.7/dist-packages/trac/util/translation.py", line 152, in activate
t.add(Translations.load(locale_dir, locale or 'en_US',
AttributeError: 'NullTranslations' object has no attribute 'add'
I am not familiar with python, any ideas why this is occurring would be appreciated.
To resolve the issue you can either upgrade to Trac 1.0.2, or downgrade to Babel 0.9.6. See comment:1:ticket:11621 for details.