Unable to launch Jupyter Notebook on Anaconda Navigator MacOS - python

I have a problem with launching jupyter notebook on the Anaconda Navigator, which is on my Mac. This is the error message that shows when I try to launch it. What should I do?
Python path configuration:
PYTHONHOME = '/System/Library/Frameworks/Python.framework/Versions/2.7'
PYTHONPATH = '/Applications/NEURON-7.4/nrn/lib/python'
program name = '/opt/anaconda3/bin/python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/opt/anaconda3/bin/python'
sys.base_prefix = '/System/Library/Frameworks/Python.framework/Versions/2.7'
sys.base_exec_prefix = '/System/Library/Frameworks/Python.framework/Versions/2.7'
sys.executable = '/opt/anaconda3/bin/python'
sys.prefix = '/System/Library/Frameworks/Python.framework/Versions/2.7'
sys.exec_prefix = '/System/Library/Frameworks/Python.framework/Versions/2.7'
sys.path = [
'/Applications/NEURON-7.4/nrn/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python38.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python3.8',
'/System/Library/Frameworks/Python.framework/Versions/2.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'
Current thread 0x00000001083335c0 (most recent call first):
<no Python frame>
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]

Related

Completely Remove Python-Related Files Windows

Something was wrong with my Python installation so I tried to fix it by uninstalling and reinstalling Python. I've tried to do so several times, but whenever I type "python" into my terminal, I get this nasty error:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = 'C:\Users\jeffrey\AppData\Local\Programs\Python\Python39\'
program name = 'python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = 'C:\\msys64\\mingw64\\bin\\python.exe'
sys.base_prefix = 'D:\\a\\msys64\\mingw64'
sys.base_exec_prefix = 'D:\\a\\msys64\\mingw64'
sys.platlibdir = 'lib'
sys.executable = 'C:\\msys64\\mingw64\\bin\\python.exe'
sys.prefix = 'D:\\a\\msys64\\mingw64'
sys.exec_prefix = 'D:\\a\\msys64\\mingw64'
sys.path = [
'C:\\Users\\jeffrey\\AppData\\Local\\Programs\\Python\\Python39\\',
'D:\\a\\msys64\\mingw64\\lib\\python310.zip',
'D:\\a\\msys64\\mingw64\\lib\\python3.10',
'D:\\a\\msys64\\mingw64\\lib\\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'
Current thread 0x00006b50 (most recent call first):
<no Python frame>
Is there a way to uninstall everything and get a fresh Python installation? I'm on Windows.
I've tried uninstalling Python using the control panel, manually deleting the files myself, and I've removed Python from the PATH each time.

Flask website shows Service 503 error when i deploy app on cPanel

I am trying to deploy my flask web app on a hosting service using the cPanel control panel. I set up a python application profile, uploaded all of my project’s files to the server, updated pip, and installed all the dependencies for my app inside the Cpanel. However, when I start the application and go to my website, I get the “503 service unavailable” error. In the generated stderr.log file, I get the following message:
Python path configuration:
PYTHONHOME = '/home/southlan/virtualenv/public_html/flask/aitells/3.8'
PYTHONPATH = '.:/home/southlan/public_html/flask/aitells/'
program name = '/home/southlan/virtualenv/public_html/flask/aitells/3.8/bin/python3.8_bin'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/home/southlan/virtualenv/public_html/flask/aitells/3.8/bin/python3.8_bin'
sys.base_prefix = '/home/southlan/virtualenv/public_html/flask/aitells/3.8'
sys.base_exec_prefix = '/home/southlan/virtualenv/public_html/flask/aitells/3.8'
sys.executable = '/home/southlan/virtualenv/public_html/flask/aitells/3.8/bin/python3.8_bin'
sys.prefix = '/home/southlan/virtualenv/public_html/flask/aitells/3.8'
sys.exec_prefix = '/home/southlan/virtualenv/public_html/flask/aitells/3.8'
sys.path = [
'.',
'/home/southlan/public_html/flask/aitells/',
'/home/southlan/virtualenv/public_html/flask/aitells/3.8/lib64/python38.zip',
'/home/southlan/virtualenv/public_html/flask/aitells/3.8/lib64/python3.8',
'/home/southlan/virtualenv/public_html/flask/aitells/3.8/lib64/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'
Current thread 0x00007f97ff5f2740 (most recent call first):
<no Python frame>
I tried searching all over the internet but couldnt find any solution that would work

How to fix anaconda prompt failure with init_fs_encoding error

Env:Win7 python38
I used to lunch the prompt script in start menu. Today It tells me a encoding error and spyder is not working too. How to fix it?
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'd:\ProgramData\Anaconda3\python.exe'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '\u0158E'
sys.base_prefix = '.'
sys.base_exec_prefix = '.'
sys.executable = '\u0158E'
sys.prefix = '.'
sys.exec_prefix = '.'
sys.path = [
'd:\\ProgramData\\Anaconda3\\python38.zip',
'.\\DLLs',
'.\\lib',
'',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the file
system encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00001f94 (most recent call first):
<no Python frame>

PyInstaller and custom module

I have one file with my own utils I use in many projects. In order not to copy it to every single project and manually pip install everything needed, I decided to make module out of it.
However, when I use PyInstaller to create .exe file from project and try to run it, I get error:
Python path configuration:
PYTHONHOME = 'C:\Users\Adam\AppData\Local\Temp\_MEI102882'
PYTHONPATH = (not set)
program name = 'C:\Users\Adam\Desktop\Praca\TEST\dist\main.exe'
isolated = 0
environment = 0
user site = 0
import site = 0
sys._base_executable = 'C:\\Users\\Adam\\Desktop\\Praca\\TEST\\dist\\main.exe'
sys.base_prefix = ''
sys.base_exec_prefix = ''
sys.platlibdir = 'lib'
sys.executable = 'C:\\Users\\Adam\\Desktop\\Praca\\TEST\\dist\\main.exe'
sys.prefix = ''
sys.exec_prefix = ''
sys.path = [
'C:\\Users\\Adam\\AppData\\Local\\Temp\\_MEI102882\\base_library.zip',
'C:\\Users\\Adam\\AppData\\Local\\Temp\\_MEI102882\\lib-dynload',
'C:\\Users\\Adam\\AppData\\Local\\Temp\\_MEI102882',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
LookupError: unknown encoding: utf-8
Current thread 0x000022ac (most recent call first):
<no Python frame>
I'm not even sure what to do now. I see that some paths refer to Temp folder, don't know, however, if this is how it should be.

Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Mac

I've set up a virtual environment on MacOS BigSur 11.6 using python 3.9.7 version.
Environment name is "ambiente" and this is how the terminal looks like :
(ambiente) mac.fede#Ahoga PageDownloader %
I'm in PageDownloader directory.
Inside this folder there is my python project.
I can run the program using : python3 PageDownloader.py and all works fine.
I tried to install and run it using PyInstaller and the UNIX executable works fine.
Then using Platypus I bottled it to an application, when the icon is double clicked a shell script runs and launches the UNIX executable file obtained before.
When I double click the application this is the output :
​initializing script //this launches PageDownloader Executable file
Python path configuration:
PYTHONHOME = '/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources'
PYTHONPATH = (not set)
program name = '/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources/PageDownloader'
isolated = 0
environment = 0
user site = 0
import site = 0
sys._base_executable = '/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources/PageDownloader'
sys.base_prefix = ''
sys.base_exec_prefix = ''
sys.platlibdir = 'lib'
sys.executable = '/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources/PageDownloader'
sys.prefix = ''
sys.exec_prefix = ''
sys.path = [
'/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources/base_library.zip',
'/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources/lib-dynload',
'/Users/mac.fede/Documents/GitHub/PageDownloader/PageDownloader.app/Contents/Resources',
]
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'
Current thread 0x000000010c0cfe00 (most recent call first):
<no Python frame>
Other posts on StackOverflow like this : Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding, when trying to start uwsgi
Suggests to remove the PYTHONHOME environment variable but I don't know how to do it. I can see that it's set and shouldn't. I did some researches on the internet but I didn't understand how to do this on Mac. I already tried :
unset PYTHONPATH
unset PYTHONHOME
Before launching the executable file but same error.
Now, I don't know if this is the right way to create an exportable application from python program on MacOS, I'm trying to figure it out so all this solution is "home made". If you have any suggestion I would be very happy to hear it.
With "exportable" I mean an application that I can share with my friends or other people and runnable with a double click.

Categories