Anaconda prompt giving an error on opening - python

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.

Related

Error when pip installing simpletransformers

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.

How to fix UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 5: invalid continuation byte

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

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.

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.

Python 2.7. Encoding into python and cmd

everyone.
I try to study django and python. But I have a problem. In my book there is such string:
django-admin.py startproject megaproject
When I try to execute this code, I get next message:
D:\Job\РАН\База Данных. Сомнология>django-admin.py startproject megaproject
Traceback (most recent call last):
File "C:\Python27\Scripts\django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
353, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 357,
in run_from_argv
self.stderr.write('%s: %s' % (e.__class__.__name__, e))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 8: ordinal
not in range(128)
This code work in english directory. But I have russian directory next type:
D:\Job\РАН\База Данных. Сомнология
This problem appear due differences encoding into python and cmd. And I cannot conform them. I try change coding into command line and into python. But I have no results. When I change encoding into cmd, I get bad string with strange symbols. When I add concretly encoding in title python-file, I have no result too.
The windows django can not work with Russian catalogs.

Categories

Resources