my python version is 2.7.14 in windows 7
I have import simplejson with command "pip install simplejson"
my code is
import os
import platform
import re
import subprocess
import sys
import threading
import simplejson
error messge is
ImportError: No module named simplejson
how can i fix this ?
Download it from here - simplejson 3.12.0
Install
Enjoy
If you have Python and pip in your PATH just run the following command in your console.
$ pip install simplejson
The console will return the following output
Collecting simplejson
Downloading simplejson-3.13.2-cp27-cp27m-win32.whl (68kB)
Installing collected packages: simplejson
Successfully installed simplejson-3.13.2
Related
Getting ImportError: No module named speech_recognition,
Code Snippet:
# for speech-to-text
import speech_recognition as sr
# for text-to-speech
from gtts import gTTS
# for language model
import transformers
import os
import time
# for data
import os
import datetime
import numpy as np
I have already tried pip3 install SpeechRecognition and pip install SpeechRecognition
pip3 install SpeechRecognition
Requirement already satisfied: SpeechRecognition in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (3.8.1)
WARNING: You are using pip version 21.3.1; however, version 22.1.2 is available.
You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.
I am using Python 3.8
I encountered the following error:
File "D:\python-win\lib\distutils\util.py", line 9, in <module>
import importlib.util
ModuleNotFoundError: No module named 'importlib.util'
I am using python 3.8 (x64) on a windows 10 machine
D:\test> python --version
Python 3.8.10
and the latest pip
(.venv) D:\test> pip --version
pip 21.3.1 from d:\test\.venv\lib\site-packages\pip (python 3.8)
As the above message indicates the error is originating from util.py which is included in the lib/dist folder of the python 3.8 distribution for windows. The offending block is
"""distutils.util
Miscellaneous utility functions -- anything that doesn't fit into
one of the other *util.py modules.
"""
import os
import re
import importlib.util
import string
import sys
from distutils.errors import DistutilsPlatformError
from distutils.dep_util import newer
from distutils.spawn import spawn
from distutils import log
from distutils.errors import DistutilsByteCompileError
All of the info I could find indicated importlib was included with python 3+, but I am seeing this error anyway.
Is there something else I am missing?
I'm trying to import montage2d module from scikit-image:
from skimage.util.montage import montage2d
But this error popped up:
ModuleNotFoundError: No module named 'skimage.util.montage'
I'm pretty sure I installed the scikit-image package as:
pip install scikit-image (0.18.1)
I'm trying pip install scikit-image==0.13.1 but it failed
enter image description here
Try:
from skimage.util import montage
Or, with older versions:
pip install scikit-image==0.13.1
from skimage.util.montage import montage2d
I'm using Heroku as a development server. When I try to push my Django application to Heroku it first tries to install my packages from the requirements.txt file.
requests==2.18.3
ssh-import-id==5.5
The problem is I have a dependency on one of my packages with others. In the above packages, ssh-import-id needs requests package already installed. So when I push the app, pip fails to install and stops the deployment.
Collecting requests==2.18.3 (from -r re.txt (line 1))
Using cached https://files.pythonhosted.org/packages/ba/92/c35ed010e8f96781f08dfa6d9a6a19445a175a9304aceedece77cd48b68f/requests-2.18.3-py2.py3-none-any.whl
Collecting ssh-import-id==5.5 (from -r re.txt (line 2))
Using cached https://files.pythonhosted.org/packages/66/cc/0a8662a2d2a781db546944f3820b9a3a1a664a47c000577b7fb4db2dfbf8/ssh-import-id-5.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-go0a5mxf/ssh-import-id/setup.py", line 20, in <module>
from ssh_import_id import __version__
File "/tmp/pip-install-go0a5mxf/ssh-import-id/ssh_import_id/__init__.py", line 25, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-go0a5mxf/ssh-import-id/
I need to install all the listed packages using pip in single attempt. Because by default Heroku runs, pip install -r requirements.txt.
This is a bug.
The library's setup.py imports the library to get the version for inclusion in the setup() function call...
import os
from setuptools import setup
from ssh_import_id import __version__
... and the library tries to import requests which doesn't yet exist in the environment. This is ssh_import_id.__init__.py:
import argparse
import json
import logging
import os
import platform
import requests # <=== here
import stat
import subprocess
import sys
import tempfile
A fix has been added which works around needing to import the package to get the version...
import os
from setuptools import setup
import sys
def read_version():
# shove 'version' into the path so we can import it without going through
# ssh_import_id which has deps that wont be available at setup.py time.
# specifically, from 'ssh_import_id import version'
# will fail due to requests not available.
verdir = os.path.abspath(
os.path.join(os.path.dirname(__file__), "ssh_import_id"))
sys.path.insert(0, verdir)
import version
return version.VERSION
... but the fix isn't in the current pypi version 5.6.
You could install latest master branch from source instead of pypi by changing your requirements.txt to something like:
-e git+https://git.launchpad.net/ssh-import-id#egg=master
I've a problem with a python-script. In a script, i have:
import zmq
from datetime import datetime
import pytz
import bottle
import logging
from bottle import response
But, when i run this script, i see:
ImportError: No module named zmq
I've also tried:
import pyzmq
When i run: pip install pyzmq, it display's that the package already is installed.
But it doesn't works. The probleem arose after i have updated Python 2.6.x to Python 2.7. I think, the plugins are not included in the upgrade?????
Does anyone have an idea?