36๐
I see your PYTHONHOME is set to PYTHONHOME = '/home/env3/educ'
. Try to check if it is really there.
The solution for me was to remove the PYTHONHOME
environment variable.
For you, it can be just that, or setting that variable to another value.
This worked on Windows, and would work on Linux for sure. If someone tries this on Linux, please post a comment here !
A CPython developer confirmed the solution here. :
This is not a Python bug, this is a symptom of setting PYTHONHOME and/or PYTHONPATH when theyโre not needed. In nearly all cases you donโt need to set either of them;
In the case of PYTHONHOME itโs almost always a mistake to set.
13๐
I solve this problem by unsetting PYTHONHOME or PYTHONPATH, because they override the virtual environment variables.
In my case this is caused by my adminโs base environment. I would try removing PYTHONHOME and PYTHONPATH variables by doing
unset PYTHONPATH
unset PYTHONHOME
- [Django]-Is_valid() vs clean() django forms
- [Django]-STATIC_ROOT vs STATIC_URL in Django
- [Django]-How to check whether the user is anonymous or not in Django?
7๐
This message is for those with the same problem who will find this page later.
I couldnโt start uWSGI with my config, and I had the same message in logging files.
init_fs_encoding: failed to get the Python codec of the filesystem
encoding Python runtime state: core initialized ModuleNotFoundError:
No module named โencodingsโ
The problem was uWSGI didnโt have enough permissions to access the virtual environment. When I fixed the permissions, uWSGI started my config.
Denys posted the uwsgi.ini config in his message. I guess the path to the virtual environment is wrong.
base = /home/env3/educ
projectname = educ
virtualenv = /home/env3/%(projectname)
If the virtual environment was created in the project directory, then the path should look like this:
virtualenv = /home/env3/%(projectname)/env
- [Django]-Django Rest Framework POST Update if existing or create
- [Django]-Django โ run a function every x seconds
- [Django]-Django : Is it impossible to static tag into block tag?
1๐
The cause of the problem in my case was in the setting of virtualenv. Under linux system, the path to virtualenv starts very likely as /home/(your login username)/env3/, not /home/env3/. So before you try other solutions, you had better make sure the path to your virtualenv is correct.
- [Django]-Is there a naming convention for Django apps
- [Django]-Django โ FileField check if None
- [Django]-Unit testing with django-celery?
- [Django]-Using mock to patch a celery task in Django unit tests
- [Django]-How to display all model fields with ModelSerializer?
- [Django]-What should I use instead of syncdb in Django 1.9?
0๐
try using http=127.0.0.1:8000 in uwsgi.ini file.
that solved my problem.
- [Django]-Django Admin Form for Many to many relationship
- [Django]-Django / file uploads permissions
- [Django]-Django- nginx: [emerg] open() "/etc/nginx/proxy_params" failed (2: No such file or directory) in /etc/nginx/sites-enabled/myproject:11
0๐
in my case I did not unset the pythonhome, pythonpath
Just simply type this in cygwin terminal:
python.exe setup.py install (take note of the ".exe")
- [Django]-How to configure where to redirect after a log out in Django?
- [Django]-How to upload multiple images to a blog post in django
- [Django]-Django ALLOWED_HOSTS IPs range
0๐
You need to clear the environment variable PYTHONHOME
Solution
Just before the line where this error occurs, add the following
import os
if 'PYTHONHOME' in os.environ:
del os.environ['PYTHONHOME']
Explanation
I encountered this issue when attempting to execute cinnamon-screensaver-command --lock
using the subprocess
module inside a python app running as an AppImage (which extracts and executes itself in a temporary squashfs filesystem).
Python path configuration:
PYTHONHOME = '/tmp/.mount_buskilParXTg/opt/python3.7'
PYTHONPATH = (not set)
program name = '/usr/bin/python3'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/usr/bin/python3'
sys.base_prefix = '/tmp/.mount_buskilParXTg/opt/python3.7'
sys.base_exec_prefix = '/tmp/.mount_buskilParXTg/opt/python3.7'
sys.executable = '/usr/bin/python3'
sys.prefix = '/tmp/.mount_buskilParXTg/opt/python3.7'
sys.exec_prefix = '/tmp/.mount_buskilParXTg/opt/python3.7'
sys.path = [
'/tmp/.mount_buskilParXTg/opt/python3.7/lib/python38.zip',
'/tmp/.mount_buskilParXTg/opt/python3.7/lib/python3.8',
'/tmp/.mount_buskilParXTg/opt/python3.7/lib/python3.8/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
If you unset the environment variable (with del os.environ['PYTHONHOME']
), then the issue goes away.
- [Django]-Django โ How to get self.id when saving a new object?
- [Django]-How to use Python type hints with Django QuerySet?
- [Django]-Django โ Reverse for '' not found. '' is not a valid view function or pattern name