Very weird problem. While python and works perfectly fine, I couldn't use pipenv.
I'm running it on windows, and it doesn't work on windows terminal, powershell, vscode terminal. Python version is 3.10.5, system PATH already has the folder location where python.exe is. I have also tried adding PYTHONPATH and PYTHONHOME variables but still did not work.
I'm still new at this, I tried pip uninstall pipenv, virtualenv, but when I run pipenv it still gives me the same error message and not the "not recognized as a command" error.
This is the error message when I run pipenv --version, pipenv shell, pipenv install etc.:
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'c:/program files/inkscape/bin/python.exe'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = 'C:\\program files\\inkscape\\bin\\python.exe'
sys.base_prefix = 'D:\\a\\_temp\\msys\\msys64\\mingw64'
sys.base_exec_prefix = 'C:\\program files\\inkscape'
sys.executable = 'C:\\program files\\inkscape\\bin\\python.exe'
sys.prefix = 'D:\\a\\_temp\\msys\\msys64\\mingw64'
sys.exec_prefix = 'C:\\program files\\inkscape'
sys.path = [
'D:\\a\\_temp\\msys\\msys64\\mingw64\\lib\\python38.zip',
'D:\\a\\_temp\\msys\\msys64\\mingw64\\lib\\python3.8',
'D:\\a\\_temp\\msys\\msys64\\mingw64\\lib\\python3.8',
'C:\\program files\\inkscape\\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 0x00006e4c (most recent call first):
<no Python frame>
I thought inkscape was the problem, so I uninstalled it, but it still doesn't work.
Please help me, thank you
I may not be able to answer your question but I might contribute to the solution:
1.try to find here why you get the ModuleNotFoundError: No module named 'encodings'
what library are you missing ?
2. Check this older thread here it may be of help : ImportError: No module named 'encodings'
3. I used to use Pipenv in my Jupiter terminal and due to colleagues engineering choices I always had problem so decided to move to Poetry check it out is really good :https://python-poetry.org/
I may have not helped you find the answer but hopefully have made a small contribution...all debugging is like criminal investigation sometimes you need to incrementally acquire new evidence to solve crimes so ..expect lots of patience from yourself and don't get disappointed easily!
This was the answer for me:
Long story short, I uninstalled the python from Microsoft Store, restarted my computer, installed using the python 3.10.5 installer from python.org, made sure I check the checkbox to “add python to PATH”, restart my computer. On the terminal, run “which python” and ensure it is on the right path, which should be “c:\users\ [username]\appdata\local\programs\python\python310\python” and not on “c:\program files\windowsapp....” This should be both on the user variable and system variable for the variable “PATH”
I consulted with a programmer friend and he helped me solve this issue.
This is the process for troubleshooting for anyone facing similar issues as I did on Windows:
Find which python, pip, and pipenv the system is using (different terminals like windows terminal, powershell, cmd prompt might have different results, so just use the one you like the most, which was for me was my modified windows terminal). The error code here only tells me the symptoms and not the actual problem. So pursuing the “encoding module not found” was actually jumping deeper into the rabbit hole. Luckily, I realized from experience that encoding was not the issue, but rather the terminal did not recognize where python or pipenv is. (I do realize that when a module or cmd is not recognized, the terminal will usually say “module not recognized” instead of the this long error prompt. So it is still a mistery to me why it did that instead of the simple “module not recognized”.
“Which python” shows the default python installation used, “python -V” shows which python it is associated with and the location, “pip show certifi” is for showing which python pip is using
I found a discrepancy, where most of my modules use appdata, which is where normally pip installs and python.org installers use. But python was using WindowsApp because I had installed it using microsoft store. (On my defense, when you google python installer most guides will tell you to install from microsoft store, which was a rookie mistake)
Uninstall the python you don’t want on “add or remove program” from windows. Then install python on its website and make sure to check the checkbox for adding the newly installed python to the system environment variable. See if it works on the terminal. Normally the computer needs to reboot to make the necessary changes.
Done! If it doesn’t work, make sure to purge every python you have on the computer, install using the installer directly from the python website, and make sure the python path is added to the environment variable
I got the P4 python module for win10 via the installer on their page: https://www.perforce.com/downloads/helix-core-api-python
Its for python 3.9, though I have tested it with both Python 3.10 and 3.9 and it always throws the error: No module named 'P4' when I try to use it inside visual code.
Interpreter is set up correctly (tried 310 and 39).
Im a bit lost here and would love some help.
The installer package installed the following files into site-packages:
P4.py
P4API.cp39-win_amd64.pyd
and a folder with 4 metadata files in it
P4.py on itself looks good, no errors.
Edit: Im trying to use it with Blender. Currently shipped python version within that is 3.10.2. Also tried a older blender version which uses 3.9.7.
Both wont work.
Visual studio code is known for it's bugs with python. You could try using "PyCharm". Make sure to install the modules from Pycharm's settings instead of terminal.
(I'm not sure if this is the reason, but it's worth the try. Had the same issue and the mentioned way solved it.)
I am trying to run a script which imports all the packages required for a code in visual studio code (there is nothing else in their at the moment apart from the import statements) all packages are installed on the environment being used.
However running just the statement
It returns the error message
I have tried uninstalling and reinstalling all packages, changing to a different environment and creating a whole new azure function.
Any help would be greatly appreciated.
It seems that there is missing a sqlite3 DLL file in your anaconda path C:\Users\954198\AppData\Local\Continuum\Anaconda3\DLLs.
Meanwhile, there is an existing SO thread Unable to import sqlite3 using Anaconda Python which got the same issue with yours, please follow the answer of most voted up to add the lack sqlite dll file to fix it.
I'm afraid that your conda environment or your python environment may be broken, sqlite3 is a default package pre-installed in Python.
A C++ python module based on pybind11 library cannot be imported anymore in python. It was working until a few weeks ago but not any more (may be since the installation of miniconda). Cannot track the exact point when this stopped working as I was not using it since many weeks. I start python in the same directory as the module, and tried to import it in the terminal. And I get the error:
ModuleNotFoundError: No module named 'ld_pybind_d'
In the mean while I also tried:
deleted the directory where miniconda was installed, rebuilt the module and linked it against python3.6m library.
Created an empty __ init__.py file in the module directory
Exported the current working directory in the PYTHONPATH environment variable
Other info:
Built 64 bit version module and I also have 64 bit version python
Python version 3.6.8
Nothing works .. Your help is very appreciated ...
As is, many times the case, if nothing really works, a restart would definitely do. I did that and seems to solve the case. Never the less, im just relieved it is loading now.
I have been trying to get SCons working now for quite a time, but didn't succeed yet. Before everything else: I'm running Windows 7 x64.
I have firstly installed Python 2.7.11 in C:\Software\Python27 and added both that directory as C:\Software\Python\Scripts to
the system path (for all users, that is). Then I installed SCons in C:\Software\Python27\Lib\site-packages\scons-2.4.1, and
the scripts in the previous mentioned scripts-directory (the directories which the SCons installation msi defaults to).
And now when I try to run SCons I get this error message:
Import failed. Unable to find SCons files in:
...
ImportError: No module named SCons.Script
As a user I really don't have any idea where the error comes from, other than that SCons can't resolve it's own imports.
I got it working by creating though by creating a new folder: C:\Software\Python27\Scripts\scons-local and moving the
contents of the SCons installation folder (...\Python27\Lib\site-packages\scons-2.4.1) to the newly created folder. But this
gives me a syntax error:
I found here that this error is due to my Python version not supporting conditional expressions, because this kind of
expressions are supported from Python 2.4 and higher. The thing is though that I am using Python 2.7.11, and thus I shouldn't get
this error.
Some help would be highly appreciated, thanks in advance!
The windows installer is no longer supported.
The best way to install SCons is now via pip
so:
python -Mpip install SCons
Note you will need Python 3.5 or newer (though at this point I'd suggest 3.10 or newer)