I can't launch ipython-listener - python

I'm trying to get up and running with an ipython plugin for gedit3, but it requires ipython-listener, and when I try to launch it I get this:
Traceback (most recent call last):
File "/usr/local/bin/ipython-listener", line 27, in <module>
from IPython.frontend.terminal.embed import InteractiveShellEmbed
ImportError: No module named terminal.embed
I'm running ipython version 0.10.2 and python version 2.7.2+
I tried to do pip install terminal.embed but couldn't find it:
Downloading/unpacking terminal.embed
Could not find any downloads that satisfy the requirement terminal.embed
No distributions at all found for terminal.embed
Storing complete log in /home/amanda/.pip/pip.log
So now what?

I tried to do pip install terminal.embed but couldn't find it
It's not a package, it's part of IPython. Your IPython is just too old (by a couple of years).
That plugin depends on IPython ≥ 0.11 (current is 0.13.1). Try:
pip install --upgrade ipython

Related

Install python package for python2.7 with pip

I am trying to install pre-commit for python2.7 with pip 8.1.2.
If i do pip install --user pre-commit or ´python -m pip install --user pre-commit´ it keeps trying to load pre-commit3.0.2 and failing.
So i tried to find the most recent version that still supports python2.7 (by manually going through the version history, is there not better way?) and that is 1.21.0.
But even when i do pip install --user pre-commit==1.21.0 it fails due to
Collecting virtualenv>=15.2 (from pre-commit==1.21.0)
Using cached https://files.pythonhosted.org/packages/7b/19/65f13cff26c8cc11fdfcb0499cd8f13388dd7b35a79a376755f152b42d86/virtualenv-20.17.1.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-build-mjJnKQ/virtualenv/setup.py", line 4, in <module>
raise RuntimeError("setuptools >= 41 required to build")
RuntimeError: setuptools >= 41 required to build
which i assume is because virtualenv-20.17.1 requires python3
Yes, I think pre-commit is not supported for Python 2.7 and starts only in 3.7 but you can write a custom hook or any other tools that you are using for linting based on the IDE you are using.The hook would need to check for any errors in the code before committing, and if any errors are found, it should fail the commit and display a warning message.

ModuleNotFoundError while using tqdm after installation in python

I'm using a python code using the package tqdm, I installed it with pip
androiddl#androiddl:~$ pip install tqdm Collecting tqdm Using cached
https://files.pythonhosted.org/packages/76/4c/103a4d3415dafc1ddfe6a6624333971756e2d3dd8c6dc0f520152855f040/tqdm-4.30.0-py2.py3-none-any.whl
Installing collected packages: tqdm Successfully installed tqdm-4.30.0
After this success message when I'm trying to run my python script I have this error :
androiddl#androiddl:~/...$
python3 download.py "com.facebook.katana" Traceback (most recent call
last): File "download.py", line 10, in
from playstore.playstore import Playstore File "/home/.../playstore/playstore.py",
line 12, in
from tqdm import tqdm ModuleNotFoundError: No module named 'tqdm'
How can I fix it ? Thank you
It seems like pip is hooked up to Python 2, and not python3, which is what you are using to run your script. Try using pip3 instead. If that doesn't work, a quick way to solve it is to use python3 -m pip install ... for now, although it's nice to have that command located at pip3. Try looking at an answer like How to install pip with Python 3? for that.

ImportError: No module named 'prometheus.client'

I am currently trying to run a sample code I code off of the internet.
While trying to run it using python2.7, I get the following ERROR :
# python2.7 example.py
Traceback (most recent call last):
File "example.py", line 9, in <module>
from http.server import HTTPServer
ImportError: No module named http.server
I tried to run the following :
# pip install http.server
Collecting http.server
Could not find a version that satisfies the requirement http.server (from versions: )
No matching distribution found for http.server
But when I use python3, it does not give me the ERROR. Rather gives the ERROR :
# python3 example.py
Traceback (most recent call last):
File "example.py", line 13, in <module>
from prometheus.client import Gauge
ImportError: No module named 'prometheus.client'
Im trying to install prometheus.client using pip and pip3 but nothing.
# pip install prometheus.collectors
Collecting prometheus.collectors
Could not find a version that satisfies the requirement prometheus.collectors (from versions: )
No matching distribution found for prometheus.collectors
# pip3 install prometheus.collectors
Collecting prometheus.collectors
Could not find a version that satisfies the requirement prometheus.collectors (from versions: )
No matching distribution found for prometheus.collectors
How can I get the missing libraries ?
EDIT ::
In the below example I am using a very minimalist approach (again from github)
from prometheus_client import start_http_server, Summary
import random
import time
# Create a metric to track time spent and requests made.
REQUEST_TIME = Summary('request_processing_seconds', 'Time spent processing request')
# Decorate function with metric.
#REQUEST_TIME.time()
def process_request(t):
"""A dummy function that takes some time."""
time.sleep(t)
if __name__ == '__main__':
# Start up the server to expose the metrics.
start_http_server(8000)
# Generate some requests.
while True:
process_request(random.random())
Running the above code yields :
# python3.4 main.yaml
Traceback (most recent call last):
File "main.yaml", line 1, in <module>
from prometheus_client import start_http_server, Summary
ImportError: No module named 'prometheus_client'
Whereas I do have the library installed.
# pip3 install prometheus_client
Requirement already satisfied: prometheus_client in /usr/lib/python2.7/site-packages
I'm running on ubuntu 18.10 and i got the same issue, and i have python2 install already. I was able to solved it by installing python3 and python3-pip like below.
sudo apt install python3
sudo apt install python3-pip
pip3 install prometheus_client
May be helpful to somebody!
http.server is a module in Python 3.
See the note for SimpleHTTPServer in Python 2:
Note The SimpleHTTPServer module has been merged into http.server in Python 3. The 2to3 tool will automatically adapt imports when converting your sources to Python 3.
For prometheus.client, you want pip install prometheus_client. See https://github.com/prometheus/client_python
README.md from the repository you linked states:
Deprecated, use: https://github.com/prometheus/client_python
I faced the exact same problem. I installed pip3 using python3 -m pip install --upgrade pip. After that ran pip3 install prometheus_client. After this, the issue got fixed.
sudo -H pip3 install prometheus_client
just worked for me
Found here
https://github.com/b-harvest/terra_oracle_voter_deprecated/issues/17

Installation Error while installing portia

Followed instructions on the github page. Of course, had to make minor changes since I was working with a windows 7 system. I got to the point post creating the virtual environment for portia to run. And I was trying to install the required packages using pip.
pip install -r requirements.txt
It failed with a log.
Now in the shell I try to run twistd, it gives error saying command not found. I even tried as follows:
deostroll#DEOTOP /c/Portia/portia/slyd (master)
$ python ../../portia_env/Scripts/twistd.py -n slyd
Traceback (most recent call last):
File "../../portia_env/Scripts/twistd.py", line 13, in <module>
from twisted.scripts.twistd import run
File "c:\Portia\portia_env\lib\site-packages\twisted\__init__.py", line 53, in
<module>
_checkRequirements()
File "c:\Portia\portia_env\lib\site-packages\twisted\__init__.py", line 37, in
_checkRequirements
raise ImportError(required + ": no module named zope.interface.")
ImportError: Twisted requires zope.interface 3.6.0 or later: no module named zop
e.interface.
(portia_env)
deostroll#DEOTOP /c/Portia/portia/slyd (master)
$
Is there an alternate procedure to follow in order to make this work on windows?
It looks like zope.interface didn't install when you ran:
pip install -r requirements.txt
Could you try running the following and see if it works?
pip install zope.interface

ImportError: cannot import name start_ipython

I have extracted ipython-1.1.0.tar.gz in /usr/lib/ipython-1.1.0 and have run the following commands to finish the build and installation:
root#my-laptop:/usr/lib/ipython-1.1.0# python setup.py build
root#my-laptop:/usr/lib/ipython-1.1.0# python setup.py install
I am using Python 2.6 and is installed under /usr/bin/python2.6 and have my additional packages under /usr/lib/python2.6/site-packages/
Now, when I am trying to start ipython notebook from shell command, I am getting the following ImportError message:
root#my-laptop:/usr/lib/ipython-1.1.0# ipython notebook
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 5, in <module>
from IPython import start_ipython
ImportError: cannot import name start_ipython
When I tried to start the IPython instance as mentioned in README.rst file, I got the following message:
root#my-laptop:/usr/lib/ipython-1.1.0# python -m IPython
/usr/bin/python: IPython is a package and cannot be directly executed
I tried easy_install and pip install
root#my-laptop:/usr/lib/ipython-1.1.0# easy_install ipython
Searching for ipython
Best match: ipython 1.1.0
Adding ipython 1.1.0 to easy-install.pth file
Using /usr/local/lib/python2.6/dist-packages
Processing dependencies for ipython
root#my-laptop:/usr/lib/ipython-1.1.0# pip install ipython
Requirement already satisfied: ipython in /usr/lib/pymodules/python2.6
Installing collected packages: ipython
Successfully installed ipython
But the ImportError problem still remains unresolved. This is not allowing to open the interactive Python.
I found some solution in the below link, but not sure about it:
https://trac.macports.org/ticket/40119
I just ran into this problem as well. Are we sure the IPython API didn't change? I got something that looks right working with:
import IPython
IPython.Shell.start()
edit:
ok, nvmind. There was also another program I installed at the same time that decided to change PYTHONPATH.
This worked for me:
import IPython
IPython.start_ipython()

Categories

Resources