I am trying import 'simplejson'module into in my pycharm project. It is throwing an error saying that import simplejson as json
ModuleNotFoundError: No module named 'simplejson'
I installed simple json in the terminal using pip3 install simplejson.
I have tried not renaming it as json but that didn't work.
Related
Im currently having issues importing modules in my venv on vscode for google cloud firestore.
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
pip -V shows python 3.8.
python -V shows Python 3.8.1.
using pip freeze, the module appears here.
firebase-admin==5.0.3
however it returns
ModuleNotFoundError: No module named 'firebase_admin'
ive triedfrom google.cloud import firestore as well but it returns ModuleNotFoundError: No module named 'google.cloud'
any help here?
Fixed it by running in python terminal. Somehow using run code in python results in this error. Could possibly be due to interpeter configuration issues
When I'm trying to import rasterio in AWS Lambda I receive the following error:
Unable to import module 'lambda_function': No module named 'rasterio._base'
At first, I received the following error:
Unable to import module 'lambda_function': No module named 'rasterio'
So I tried to pip install the module, compressed it into a zip, and upload it as a layer(I did the same for the requests module and it worked just fine),
but now I'm getting:
Unable to import module 'lambda_function': No module named 'rasterio._base'
I've also tried:
Creating an empty virtual environment -> pip installing rasterio ->
compressing the module.
Installing different versions of rasterio
When I try to import rasterio._base through the CLI it works, but for some reason it fails to compile in the lambda.
Any suggestions?
use rasterio-lambda-layer - see https://github.com/addresscloud/rasterio-lambda-layer
I was going through an Reinforcement Learning Course and wanted to try running the code locally. I installed RLGlue with pip install rlglue from here
But then when trying to run the code:
from rlglue.rl_glue import RLGlue
import main_agent
import ten_arm_env
import test_env
Received this error message:
ModuleNotFoundError: No module named 'rlglue.rl_glue'
Any idea on how to fix that to import the module?
I use this as work-around, add this file to your project.
https://gist.github.com/niektuytel/eab1117070454042b11e5e5c026dd3fb
I setup virtualenv using python 3.4.3 and tried to import JSONDecodeError from json.decoder
from json.decoder import JSONDecodeError (I think its valid in python3 ? But why not working for me ?)
But it is not working. Only below is working:
from simplejson import JSONDecodeError
How I did ?
virtualenv venv --no-site-packages -p python3
pip install ipython
ipython
from json.decoder import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError'
According to 3.4.x docs, plain ValueError is raised when JSON decoding fails.
JSONDecodeError class is available starting from 3.5.x.
According to Docs from module json (Python version >= 3.5.0), Python which version < 3.5.0 does not support import statement like what you just did, but if you use Python(version>=3.5.0), your import statement is definitely correct.
json is the version of simplejson that has been integrated into Python. They have since been developed separately and are not the same anymore. So they cannot necessarily be used interchangably.
See this answer for more details about the differences.
I am new to python so this could be a wrong question to ask .I have installed python 3.4 and is trying to convert an old project of python 2.2 to python 3.
I have the pythonpath as "C:\ABC;C:\XY"
I do have the following structure :
In the install.py, there is code to import MiscUtils.Utils1.py:
from MiscUtils import Utils1
But in the Utils1.py , another code is there to import Utils2.py:
from UserUtils import Utils2
When I execute the install.py, I am getting the following error:
"No module named Utils2"
I tried many a things but its not working. If I put in the Utils1.py the following:
from .UserUtils import Utils2
I am getting "No Module named MiscUtils.UserUtils"
How can I import all these modules correctly
?