Error when pip installing simpletransformers - python

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.

Related

Raspberry Pi: Fatal Python error: initsite: Failed to import the site module

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.

UnicodeDecodeError when trying to upgrade "pip" or "install pywinusb"

I'm trying to upgrade pip, and also install pywinusb, but I'm getting the error: "UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 8: ordinal not in range(128)".
Pip upgrade:
PS C:\Python27> pip --version
pip 18.1 from c:\python27\lib\site-packages\pip (python 2.7)
PS C:\Python27> python -m pip install --upgrade pip
Collecting pip
Exception:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\_internal\cli\base_command.py", line 143, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\_internal\commands\install.py", line 318, in run
resolver.resolve(requirement_set)
File "C:\Python27\lib\site-packages\pip\_internal\resolve.py", line 102, in resolve
self._resolve_one(requirement_set, req)
File "C:\Python27\lib\site-packages\pip\_internal\resolve.py", line 256, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "C:\Python27\lib\site-packages\pip\_internal\resolve.py", line 209, in _get_abstract_dist_for
self.require_hashes
File "C:\Python27\lib\site-packages\pip\_internal\operations\prepare.py", line 283, in prepare_linked_requirement
progress_bar=self.progress_bar
File "C:\Python27\lib\site-packages\pip\_internal\download.py", line 836, in unpack_url
progress_bar=progress_bar
File "C:\Python27\lib\site-packages\pip\_internal\download.py", line 673, in unpack_http_url
progress_bar)
File "C:\Python27\lib\site-packages\pip\_internal\download.py", line 895, in _download_http_url
file_path = os.path.join(temp_dir, filename)
File "C:\Python27\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 8: ordinal not in range(128)
You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
And in "pywinusb" install:
PS C:\Python27> pip install pywinusb
Collecting pywinusb
Exception:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\pip\_internal\cli\base_command.py", line 143, in main
status = self.run(options, args)
File "c:\python27\lib\site-packages\pip\_internal\commands\install.py", line 318, in run
resolver.resolve(requirement_set)
File "c:\python27\lib\site-packages\pip\_internal\resolve.py", line 102, in resolve
self._resolve_one(requirement_set, req)
File "c:\python27\lib\site-packages\pip\_internal\resolve.py", line 256, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\python27\lib\site-packages\pip\_internal\resolve.py", line 209, in _get_abstract_dist_for
self.require_hashes
File "c:\python27\lib\site-packages\pip\_internal\operations\prepare.py", line 283, in prepare_linked_requirement
progress_bar=self.progress_bar
File "c:\python27\lib\site-packages\pip\_internal\download.py", line 836, in unpack_url
progress_bar=progress_bar
File "c:\python27\lib\site-packages\pip\_internal\download.py", line 673, in unpack_http_url
progress_bar)
File "c:\python27\lib\site-packages\pip\_internal\download.py", line 895, in _download_http_url
file_path = os.path.join(temp_dir, filename)
File "c:\python27\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 8: ordinal not in range(128)
You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Before this I have installed the package "pyusb" without any problem, without getting any error.
I've searched in google for this error, but not getting a very good explanation.
How to solve this error?
This occurs if your current working directory has name with non ASCII characters.Example ¢, Ë, Ñ, ß etc.
Remove those from the directory or file name and you are good to go.
About this particular error: "UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 8: ordinal not in range(128)", when trying to upgrade pip or install any python packet, was related to the user folder name.
My user folder name was "C:/Users/Sérgio Neves", and the "é" in "Sérgio" was the problem, so I changed the user folder name to "C:/Users/SergioNeves", without any accent and space.
I followed this video to change the folder name:
https://www.youtube.com/watch?v=J_rTOA4gXJI

UnicodeDecodeError when instaling new package

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.

when install OSMnx get erroe "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 24: invalid continuation byte"

I have Python 3.6.1 32 bit,
OS windows 10 x64,
Tried install
pip install OSMnx
get error
Exception:
Traceback (most recent call last):
File "C:\Users\liuzi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\compat__init__.py", line 73, in console_to_str
return s.decode(sys.stdout.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 24: invalid continuation byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\liuzi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\liuzi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "C:\Users\liuzi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\liuzi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "C:\Users\liuzi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "C:\Users\liuzi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_install.py", line 439, in run_egg_info
command_desc='python setup.py egg_info')
File "C:\Users\liuzi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\utils__init__.py", line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File "C:\Users\liuzi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\compat__init__.py", line 75, in console_to_str
return s.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 24: invalid continuation byte
The OSMnx installation instructions suggest using conda-forge to install. This is particularly important on Windows, as you want to avoid compiling all the C extensions required by the geospatial dependencies.
conda install -c conda-forge osmnx
Or if all else fails, do the install in a nice clean virtual environment:
conda create --yes -c conda-forge -n OSMNX python=3 osmnx
source activate OSMNX
That should solve any Windows-related install problems (and works for Mac and Linux too).

Can't instal Scrapy/Twisted

When I use "pip install" to install scrapy for Python on Windows, I request this feedback:
Exception:
Traceback (most recent call last):
File "c:\users\limin\appdata\local\programs\python\python36\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 30: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\limin\appdata\local\programs\python\python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\limin\appdata\local\programs\python\python36\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "c:\users\limin\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "c:\users\limin\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_install.py", line 878, in install
spinner=spinner,
File "c:\users\limin\appdata\local\programs\python\python36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File "c:\users\limin\appdata\local\programs\python\python36\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 30: invalid start byte
I know it maybe a coding problem, but I don't know how to solve it.
Who can help me?
Thanks.
Scrapy runs on Python 2.7 and Python 3.3 or above (except on Windows where Python 3 is not supported yet).
Sorry to be the bearer of bad news. It's worth a chance to use Anaconda, which is also stated in the Scrapy docs, if you're particularly hell bent on using Python 3.6. Or if it's urgent, you can use Python 2.7 and pip install scrapy. From my experience, Python 2.7 works a lot better when in comes to Scrapy.

Categories

Resources