No module named twilio - python

I am trying to import twilio using python. I already installed twilio on my Mac, and when I type into Terminal
pip install twilio
I get
Requirement already satisfied (use --upgrade to upgrade): six in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from twilio)
However when I type
import twilio
into my Python IDE, it says No module named twilio

You would need to configure your IDE for version 2.7 of Python.
Python IDLE: Change Python Version

Which IDE are you using? For example when I use PyCharm it's better to work on a python project that uses a virtual environment.
The PyCharm can detect (or you can configure it manually) the environment path so it can get all the packages you have installed.
Same with vscode, if you use a virtual env, the editor can know the Python executable to use (in this case the virtual env one with all its packages, including of course Twilio).

First update your python version then go on figure out the compiler of the same version on any IDE you're using and then, you'll be able to use the command.

Related

Why there is a python version besides the package version?

When I check the version of a package, I get a python version in parentheses. What does it mean?
This python 3.7.3 does not match with the PyCharm interpreter I am using (python 3.8). Is that the reason? Should I worry the version between parentheses is not the same as my python project interpreter?
It is possible that you have many python versions installed on your computer.
You probably need to pip install again the same package for the python version you are using with your Pycharm if you want them to work correctly.
if you are not sure how to do that with CMD commands,
you can access your Pycharm, look for "Python packages" at the bottom, and then search for your package.
You can see there is this package is installed already or not.
and if not - just hit the 'install' button.
after that, you are ready to go.

Python isn't recognizing installed modules on Raspberry Pi

I've installed Pillow using the Pip command, and it says it's installed in the system. When I run my Python3 program that imports Pillow, it returns a module not found error.
Here is the error:
sudo pip3 install Pillow
This returns:
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (8.1.2)
Then after I run my Python program which uses Pillow, I get this:
ModuleNotFoundError: No module named 'pillow'
Thanks!
Maybe you are using another version of python when you run your script..
Try to run your script from the terminal and write before it (python3)
You are probably trying to run it with a different python version or in a virtual environment, you can provide controls by going into the settings of your code editor.

No module named 'odf' due to wrong Python version

I have many different versions of Python, but a version that I use and that terminal show me if use command Python – version is 3.10.0.
When I use command pip list I got a big list of library, including the one I recently installed odfpy.
I open VsCode, choose Python version 3.10.0 and try to import odf but...
ModuleNotFoundError: No module named 'odf'
For sure I need to set something on VsCode or change some configuration in Linux but I cannot find a normal explanation of how to solve this issue.
If I change the Python version in VsCode with 3.8.10, odfpy (and also Django just installed) is recognized. So I suppose that, even if the Python version selected on the terminal is 3.10.0, when I pip install something, is installed on version 3.8.10. How do you manage this?
Please check which pip you are using through the command of pip --version.
After you switch the python interpreter in the VSCode, please create a new terminal, and make sure it has activated the environment you have selected.
I also use VS code and use Python 3.10 and i had try to download the odfpy which has gone alright, i use the command python -m pip install odfpy
try and see if it work for you though.
If it does not work, maybe try and create a virtual environment if you haven't created it yet.
In my case i was getting same error while using import-export django module. Installing odf library didn't worked got same error. I resolve this issue by simply pip install tablib==0.14.0.

What is the difference between <package name> and python-<package name>?

I want to downgrade tornado to a previous version because the new one causes an error according to the answers here: Jupyter notebook kernel not connecting. I am on Ubuntu, in a virtual environment.
To check the current version of it, I used pip freeze and got this: tornado==6.0.1. When I use apt-cache policy tornado the output is: "Unable to locate package tornado". When I type apt-cache policy python-tornado the output is "python-tornado: Installed: 4.5.3-1".
How do I proceed from here? My ultimate goal is to make the jupyter notebook run, and I need to figure out this tornado module for that. What is the difference between tornado and python-tornado? Which one I should care about?
One of those names is the actual package name under which it is published to the Python Package Index (PyPI), which is the namespace that pip deals in.
The other is the name as set by your Ubuntu operating system, and given the version string, I am guessing that you are using Ubuntu 18.04 Bionic Beaver. Ubuntu uses a strict naming convention, where all Python packages must start with a python- prefix. These packages are managed and installed by your OS package manager.
How to proceed depends on your Jupyter setup. If it is installed and running from a virtualenv, then you can use the pip command when the virtualenv is active to alter versions there. Take into account that using pip should already ensure you are getting compatible versions installed; you could try to upgrade jupyter if tornado was upgraded independently.
If you are using the Ubuntu-managed jupyter package then there too the package manager should take care of matching versions.
However, if you you are using a virtualenv that still has access to the OS-mananged jupyter system while locally only tornado is installed, then you want to add jupyter to your virtualenv to mask the system version, which is too old.

PyCharm, can not import modules

I need to import
1.yaml
2.pypiper
modules to the latest PyCharm IDE. I can not find pypiper in the list of available modules. When I am trying to add a new repository for the pypiper:
https://github.com/epigen/pypiper.git
still the same: typing pypiper in the search field does not yield anything.
yaml at the same time can be found, but it is giving me an error when I am trying to add it:
Could not find a version that satisfies the requirement yaml (from versions: )
No matching distribution found for yaml
PyCharm looks for packages in the repositories that it has been told to look in. By default it looks at https://pypi.python.org/simple.
Effectively this means that if you cannot install something through pip, you cannot install through the PyCharm interface.
What you need to do is to figure out:
How to install yaml
sudo pip install pyyaml
How to install pypiper
pip install --user https://github.com/epigen/pypiper/zipball/master
When I run into these issues it's easiest for me to just install on the command line opposed to through PyCharm unless it's a virtual env. Just make sure your pip is referencing the same python interpreter you are using in PyCharm or you still wont see it in PyCharm.

Categories

Resources