I have installed python 2.7.12 with PATH access and correctly installed twilio. However, when I try to execute a code I get this error message:
Traceback (most recent call last):
File "C:\Python27\textmessage.py", line 1, in <module>
from twilio.rest import TwilioRestClient
ImportError: No module named twilio.rest
Also, I want to know where we have to install Twilio, as I installed the Twilio library and placed it inside the Scripts folder.
You should not put modules into the Scripts folder.
To install twillio, see the documentation.
Check the path. I had the same problem when I put the file send_text.py in the folder called C:\Python27\Projects. I then copy the file and placed in in the folder C:\Python27 where the libs folder is right under it. The module ran. This was a test on my system.
Related
I seem to be having a weird issue where I get an error that the "requests" module is not found when I try to launch python from the Windows command line. I've attached the exact entry from the command line below. Is this something with the PYTHONPATH?
C:\Users>python
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python39\Lib\site-packages\shareplum\site.py", line 6, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
I've tried looking at the PATH environmental variable.
try to delete C:\Users\<your Username>\AppData\Local\Programs\Python\Python39\Lib\site-packages\shareplum.
It seems as if this library is overwriting the important internal site package, which is required to run python properly.
Aditionally, it seems to be incorrectly installed, as the requests module is required to run it, but is not installed.
Simply run this in CMD and then try to start python again (it will delete the directory and all of its subdirectorys)(you dont need to replace "%USERNAME%", CMD does that for you.):
rmdir /S /Q "C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python39\Lib\site-packages\shareplum"
I'm using Pymakr on VScode to program a Pycom L01, which is connected to several sensors.
i'm trying to use smbus2 library, but i can't import it.
I created a python virtual enviroment and installed it using 'pip install smbus2', but when i try to upload the sketch, the output is:
Traceback (most recent call last):
File "main.py", line 4, in <module>
File "/flash/lib/bmp280.py", line 3, in <module>
ImportError: no module named 'smbus2'
Pycom MicroPython 1.18.2.r1 [v1.8.6-849-e0fb68e] on 2018-12-08; LoPy with ESP32
Type "help()" for more information.
Someone who can help me?
May be You have not installed smbus2 module. Please install it and import it in your program.
Solved, that was a noob mistake.
The project files were outside the virtual enviroment directory.
oof.
I keep getting this error in VS Code:
Traceback (most recent call last):
File "c:\Users\User Name\Documents\Productivity\Coding\Python\Udemy\Projects from course\MilestoneP2\app.py", line 1, in <module>
import MilestoneP2.utils.Operations_db as Db
ModuleNotFoundError: No module named 'MilestoneP2'
I have recently shifted from Pycharm to VS Code and I am trying to open some of those projects from pycharm in VS Code but there is the above error haunting me.
PS: I have my Python Interpreter in a different directory and not in the workspace folder. It's in D:\Python\venv Drive
Here is my code:
import MilestoneP2.utils.Operations_db as Db
Here is the file hierarchy.
Anyone Help?
Thank you
If you run the script within VSCode there is a Python version button on bottom-left.
When you click on it you can specify your Python or virtual environment path. It will also try to find them automatically from directories. Then you can run your scripts with the spesified environments.
I am trying to use PyOsmium but it will not import. python3 setup.py install appears to complete just fine but when I import osmium I get the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/dylan/Downloads/osmium/osmium/__init__.py", line 1, in <module>
from ._osmium import *
ImportError: No module named 'osmium._osmium'
I have no idea what's causing this and it's my first time manually installing a C++ wrapper. I have the top-level PyOsmium and libosmium directories in the same directory. Is it trying to import the C++ files?
Any help would be much appreciated.
I had the same problem. The solution, as provided by one of the maintainers, is very easy:
Are you in the pyosmium root directory while trying the import? Change the directory to somewhere else and try again. In the root directory the local osmium source directory takes precedence over your freshly installed version.
Change to a different directory from the one you compiled in and it should work; it did for me.
I'm trying to install Plone 3.3rc4 with plone.app.blob and repoze but nothing I've tried has worked so far. For one attempt I've pip-installed repoze.zope2, Plone, and plone.app.blob into a virtualenv. I have this version of DocumentTemplate in the virtualenv's site-packages directory and I'm trying to get it running in RHEL5.
For some reason when I try to run paster serve etc/zope2.ini in this environment way Python gives the message ImportError: No module named DT_Util? DT_Util.py exists in the directory, __init__.py is there too, and the C module it depends on is there. I suspect there's some circular dependency or failure when importing the C extension. Of course this module would work in a normal Zope install...
>>> import DocumentTemplate
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "DocumentTemplate/__init__.py", line 21, in ?
File ".../lib/python2.4/site-packages/DocumentTemplate/DocumentTemplate.py", line 112, in ?
from DT_String import String, File
File ".../lib/python2.4/site-packages/DocumentTemplate/DT_String.py", line 19, in ?
from DocumentTemplate.DT_Util import ParseError, InstanceDict
ImportError: No module named DT_Util
I must say I doubt DocumentTemplate from Zope will work standalone. You are welcome to try though. :-)
Note that DT_Util imports C extensions:
from DocumentTemplate.cDocumentTemplate import InstanceDict, TemplateDict
from DocumentTemplate.cDocumentTemplate import render_blocks, safe_callable
from DocumentTemplate.cDocumentTemplate import join_unicode
You'll need to make sure those are compiled. My guess is that importing the cDocumentTemplate module fails and thus the import of DT_Util fails.