I am trying to install a package that I have used many times with python 2.7 and ubuntu 14.04, however it fails now with following error:
Cleaning up…
Exception:
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/pip/basecommand.py”, line 122, in main
status = self.run(options, args)
File “/usr/lib/python2.7/dist-packages/pip/commands/install.py”, line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File “/usr/lib/python2.7/dist-packages/pip/req.py”, line 1198, in prepare_files
do_download,
File “/usr/lib/python2.7/dist-packages/pip/req.py”, line 1376, in unpack_url
self.session,
File “/usr/lib/python2.7/dist-packages/pip/download.py”, line 582, in unpack_http_url
unpack_file(temp_location, location, content_type, link)
File “/usr/lib/python2.7/dist-packages/pip/util.py”, line 643, in unpack_file
untar_file(filename, location)
File “/usr/lib/python2.7/dist-packages/pip/util.py”, line 574, in untar_file
path = os.path.join(location, fn)
File “/usr/lib/python2.7/posixpath.py”, line 80, in join
path += ‘/’ + b
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe2 in position 47: ordinal not in range(128)
Storing debug log for failure in /home/ubuntu/.pip/pip.log
I googled around and it supposed to be a locale error, I managed to set locale to en_us.utf-8 it didn’t change anything. I don’t understand much about these settings, so I don’t know what to do next.
Could anybody help me out with this?
The package name is AllAuth and it fails with any version, new old, everything fails.
Try this executing
export PYTHONIOENCODING=utf8
try this link. Might be helpful for you.
Make sure that the package you're trying to install is Python 2 compatible. More and more modules are migrated to Python 3 and the new version handles unicode characters differently than version 2.
Related
I am trying to install simpletransformers via pip, but it gives me the following error:
"ERROR: Exception:
Traceback (most recent call last):
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 180, in _main
status = self.run(options, args)
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 204, in wrapper
return func(self, options, args)
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 393, in run
installed = install_given_reqs(
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/req/__init__.py", line 77, in install_given_reqs
requirement.install(
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 782, in install
install_wheel(
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py", line 810, in install_wheel
_install_wheel(
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py", line 653, in _install_wheel
file.save()
File "/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py", line 419, in save
with open(self.dest_path, "wb") as dest:
UnicodeEncodeError: 'latin-1' codec can't encode character '\U0001f4f9' in position 75: ordinal not in range(256)
"
I am working on jupyterhub and have tried creating a conda environment with Python version 3.7 as suggested in other cases, but the problem was not solved.
Any tips are welcome!
The problem comes from the encodage.
I think these topics could help you.
Streamlit install fails on GitLab CI with UnicodeEncodeError
'ascii' codec can't encode character : ordinal not in range (128)
In general google your error message you'll find o lot of related post and maybe your answer.
With no system changes, just a reboot, my raspberry pi (buster) python 3.7 installation does this when the python3 command is run:
Traceback (most recent call last):
File "/usr/lib/python3.7/site.py", line 603, in <module>
main()
File "/usr/lib/python3.7/site.py", line 590, in main
known_paths = addsitepackages(known_paths)
File "/usr/lib/python3.7/site.py", line 366, in addsitepackages
addsitedir(sitedir, known_paths)
File "/usr/lib/python3.7/site.py", line 213, in addsitedir
addpackage(sitedir, name, known_paths)
File "/usr/lib/python3.7/site.py", line 169, in addpackage
for n, line in enumerate(f):
File "/usr/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 342: invalid continuation byte
I'm unable to uninstall python using apt-get because that same error gets thrown partway through the uninstall process.
Any idea how to fix the error, or remove python so I can re-install it?
For future users: It looks like the SD card on the pi is dying. I managed to get python semi-working by copying a working python directory for another raspberry pi, but apt-get source files were corrupted as well. Managed to get my working files off, but a new SD card is required.
I tried to install anaconda 2.7 on my new computer(running win10), but failed.
I had it installed on my old laptop (running win7), and I was using spyder happily. Now after the install, the Navigator refuses to open, and the anaconda prompt gives an error first hand when opening.
The error i am receiving:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda2\Scripts\conda-script.py", line 12, in
sys.exit(main())
File "C:\ProgramData\Anaconda2\lib\site-packages\conda\cli\main.py", line 145, in main
init_loggers()
File "C:\ProgramData\Anaconda2\lib\site-packages\conda\cli\main.py", line 56, in init_loggers
from ..gateways.logging import initialize_logging, set_verbosity
File "C:\ProgramData\Anaconda2\lib\site-packages\conda\gateways\logging.py", line 14, in
from ..common.io import attach_stderr_handler
File "C:\ProgramData\Anaconda2\lib\site-packages\conda\common\io.py", line 580, in
class time_recorder(ContextDecorator): # pragma: no cover
File "C:\ProgramData\Anaconda2\lib\site-packages\conda\common\io.py", line 581, in time_recorder
record_file = get_instrumentation_record_file()
File "C:\ProgramData\Anaconda2\lib\site-packages\conda\common\io.py", line 577, in get_instrumentation_record_file
return expand(os.environ.get("CONDA_INSTRUMENTATION_RECORD_FILE", default_record_file))
File "C:\ProgramData\Anaconda2\lib\site-packages\conda\common\path.py", line 49, in expand
return abspath(expanduser(expandvars(path))
enter code here
File "C:\ProgramData\Anaconda2\lib\ntpath.py", line 311, in expanduser
return userhome + path[i:]
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe1 in position 13: invalid continuation byte
I tried reinstalling anaconda completely, tried both 64 and 32 bit versions, tried miniconda, same error all the time.
Would really appreciate any help!
Seems to be related to non-utf-8 characters in your home directory.
See a similar issues for 'ascii' codec:
https://github.com/conda/conda/issues/1631
https://github.com/conda/conda/issues/1180
If you need to use Python 2 it is suggested to use Anaconda3 and create a Python 2 environment from that.
I am trying to run a newly created environment on a server and get UnicodeDecodeError.
Windows 7, 64-bit. I have created a virtual environment and directed code to the source folder. Here are django, python and virtualenv versions installed. I have tried installing older versions of django and python and got the same error.
When searching for troubleshooting recommendations I only find articles related to .csv and pandas.
Django==2.2.7
pytz==2019.3
virtualenv==16.7.7
PS: C:\Users\User\Dev\Selectia\src> python manage.py runserver
Here is the output:
Watching for file changes with StartReloader
Performing system checks...
System checkidentified no issues (0 silenced).
November 05, 2019 - 12:02:31
Django version 2.2.7, using setings 'foodie.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREALK.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\threading.py", line 865, in run
self._target(*self.args, **self._kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 54 in wrapper
fn(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 203, in run
httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 67, in __init__
super().__init__(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 452, in __init__
self.server_bind()
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\wsgiref\simple_server.py", line 50, in server_bind
HTTPServer.server_bind(self)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\http\server.py", line 139, in server_bind
self.server_name = socket.getfqdn(host)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\socket.py", line 676, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecoderError: 'utf-8' code can't decode byte 0xcf in position 5: invalid continuation byte
Could you please help me out to find out the ways how to address this error message?
P.S. This is my first web framework project and I have some knowledge in python. I would really appreciate any help provided. I would like to build my own website.
You have aliases in your hosts file which contain characters which cannot be decoded as UTF-8. Remove them to solve the problem (it's probably easiest to make any aliases ASCII-only).
The default location for the hosts file on Windows 7 is
C:\Windows\System32\Drivers\etc\hosts
I'm not 100% positive as to what is the correct place to post this question since it's 50% programming since it's a python bug and 50% system management, since it's a bug on a package. I went on to post here, If I'm incorrect please direct me to the right place.
I'm currently running Arch Linux 64 bit and earlier today I updated a couple of packages including the (critical I believe) python-setuptools. Before this pip worked perfectly, no issues whatsoever, now however just from running the bare command I get the following:
espaco#Arch ~> pip
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3143, in <module>
#_call_aside
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3129, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3156, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 649, in _build_master
ws = cls()
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 642, in __init__
self.add_entry(entry)
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 698, in add_entry
for dist in find_distributions(entry, True):
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2136, in find_on_path
path_item, entry, metadata, precedence=DEVELOP_DIST
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2518, in from_location
version = cls._version_from_metadata(dist_path) or version
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2841, in _version_from_metadata
return _version_from_file(strm)
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2483, in _version_from_file
line = next(iter(version_lines), '')
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 116: ordinal not in range(128)
Is this something I did wrong or does pip have a bug? How would I be able to fix this?
What I have tried:
Reinstalling pip
Reinstalling python-setuptools
The almighty reboot
Ask my mom to kiss bash in the forehead
Search the Arch package list for a bug report
Google the problem
$ ll /var/cache/pacman/pkg/python-setuptools-*
then select desired version, and
$ sudo pacman -U /var/cache/pacman/pkg/python-setuptools-1:18.7-1-any.pkg.tar.xz
where 1:18.7-1 is your previous version of the package
if it will not help:
$ cat /var/log/pacman.log | grep 2015-11-30 | grep upgraded
and then for each package install it's previous version by doing part 1
you can write a script for that or find existing.
also try to search arch community forums