I have installed jenkins module in the VM but still not able import the module and use.
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import jenkins
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/jenkins.py", line 9, in <module>
lookup3 = cdll.LoadLibrary(os.path.join(get_python_lib(), "lookup3.so"))
File "/usr/lib64/python2.7/ctypes/__init__.py", line 438, in LoadLibrary
return self._dlltype(name)
File "/usr/lib64/python2.7/ctypes/__init__.py", line 360, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/python2.7/site-packages/lookup3.so: cannot open shared object file: No such file or directory
Have you installed jenkins by this command?
pip install jenkins
if yes you should try to install it with
pip install python-jenkins
Ref: Bug
This is already answered by Daniel Salinas (imsplitbit) on lunchpad at
bug in jenkins lib
Close this bug, it appears pip was installing jenkins 1.0.2 not python-jenkins 0.2 which is actually used. These two modules use the same module namespace so it may be valuable to change that some how or even just add python-jenkins to the pip-requires so that this isn't an issue to begin with.
I just met it. That's how it was solved
$ pip uninstall jenkins
Uninstalling jenkins-1.0.2:
/usr/local/lib64/python3.6/site-packages/__pycache__/jenkins.cpython-36.pyc
/usr/local/lib64/python3.6/site-packages/jenkins-1.0.2-py3.6.egg-info
/usr/local/lib64/python3.6/site-packages/jenkins.py
/usr/local/lib64/python3.6/site-packages/lookup3.cpython-36m-x86_64-linux-gnu.so
Proceed (y/n)?
here is a file: lookup3.cpython-36m-x86_64-linux-gnu.so, soft connection to the corresponding position is OK
sudo ln -s /usr/local/lib64/python3.6/site-packages/lookup3.cpython-36m-x86_64-linux-gnu.so /usr/lib/python3.6/site-packages/lookup3.so
Related
I am trying to run some code on an AWS ec2 (ubuntu). When I comment out the portion that displays graphs from matplotlib, it runs fine. However, I want to view graphs.
When running the code, I get this error:
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3.py", line 18, in <module>
import gi
ModuleNotFoundError: No module named 'gi'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "run.py", line 8, in <module>
from process_mask import ProcessMasks
File "/home/ubuntu/rPPG/process_mask.py", line 10, in <module>
matplotlib.use('GTK3Agg')
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/matplotlib/cbook/deprecation.py", line 307, in wrapper
return func(*args, **kwargs)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/matplotlib/__init__.py", line 1307, in use
switch_backend(name)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/matplotlib/pyplot.py", line 221, in switch_backend
backend_mod = importlib.import_module(backend_name)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3agg.py", line 4, in <module>
from . import backend_agg, backend_cairo, backend_gtk3
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3.py", line 20, in <module>
raise ImportError("The GTK3 backends require PyGObject")
ImportError: The GTK3 backends require PyGObject
I've been searching SO and other sources and have tried a lot of things including:
sudo apt-get install python3-gi
pip install vext
pip install vext.gi
sudo apt install python3-gi
pip3 install --user pgi
Also, this works:
$ /usr/bin/python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>>
but my actual code is in a virtual env with a bunch of dependencies, so this doesn't work with my actual code (/usr/bin/python run.py).
I ran into exact same issue, but after much efforts I managed to make TkAgg working (which was giving the import error for _tkagg). Little late, but someone might find it useful.
FWIW I resolved the issue as follows (to use TkAgg):
◉ Installed tk-dev from package manager
◉ Reinstalled python3-tk from package manager
◉ Rebuilt and reinstalled matplotlib from source
◉ (and of course setting TkAgg in matplotrc)
If you think you have tk-dev and python3-tk installed correctly, you need to rebuild and reinstall matplotlib, so that it generates _tkagg.py in your backends directory.
I'm using Python3.3 (numpy 1.7) on LM14. But I think it should work on Ubuntu/Python3.2
Thanks
Recently installed a github package through conda in windows that has created a new Python environment.
Whenever I try to run Spyder in the new environment I get the following error:
Error processing line 1 of C:\Users\cip18jjp\Anaconda3\envs\ox\lib\site-packages\matplotlib-3.2.1-py3.8-nspkg.pth:
Traceback (most recent call last):
File "C:\Users\cip18jjp\Anaconda3\\Lib\site.py", line 168, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "C:\Users\cip18jjp\Anaconda3\Lib\importlib\__init__.py", line 51, in <module>
_w_long = _bootstrap_external._w_long
AttributeError: module 'importlib._bootstrap_external' has no attribute '_w_long'
Remainder of file ignored
Python 3.8.2 | packaged by conda-forge | (default, Mar 23 2020, 17:32:17) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
osmnx and the command as given on the github page: conda config --prepend channels conda-forge conda create -n ox --strict-channel-priority osmnx
Solved: Path variable in windows pointed to some different Python file locations.
This is because python and pip are installed on different sources. For more info, please look at the following post
using pip3: module "importlib._bootstrap" has no attribute "SourceFileLoader"
I am working with Debian. I have installed Anaconda, then I created a virtual environment with Python2.7, and finally according with Pattern Anaconda Cloud I installed pattern by typing conda install -c asmeurer pattern
When I try to run the first example from here Pattern Clips I have the followinf error:
Python 2.7.14 |Anaconda custom (64-bit)| (default, Dec 7 2017, 17:05:42)
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pattern.web import Twitter, plaintext
>>> twitter = Twitter(language='en')
>>> for tweet in twitter.search('"more important than"', cached=False):
... print plaintext(tweet.text)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/anaconda3/envs/venv27/lib/python2.7/site-packages/pattern/web/__init__.py", line 1471, in search
data = url.download(cached=cached, **kwargs)
File "/home/user/anaconda3/envs/venv27/lib/python2.7/site-packages/pattern/web/__init__.py", line 420, in download
data = self.open(timeout, proxy, user_agent, referrer, authentication).read()
File "/home/user/anaconda3/envs/venv27/lib/python2.7/site-packages/pattern/web/__init__.py", line 381, in open
if e.code == 403: raise HTTP403Forbidden(src=e)
pattern.web.HTTP403Forbidden
>>>
Any idea what is happening ? Thank you in advance
I solve the problem by installing Pattern directly from github. In order to do so I had to remove the Pattern version I had already installed in my virtual environment by conda remove pattern and then pip install git+git://github.com/clips/pattern
I am using oct2py to call a octave function in my python code. The file is saved as .py file in the htdocs folder.
#!/usr/bin/python
import cgi
import oct2py
from oct2py import octave
print('Content-type:text/html\r\n\r\n')
print('<!DOCTYPE html>')
firnum='23'
secnum='33'
octave.addpath('/Applications/XAMPP/xamppfiles/htdocs/mypython/Octavemfiles/')
firnum=int(firnum)
secnum=int(secnum)
answer=octave.mymultfunct(firnum,secnum)
print(answer)
The code works well when executing from the terminal and gives the answer. But when I call it through the web, the oct2py gives an error stating
OSError: Octave Executable not found, please add to path or set"OCTAVE_EXECUTABLE" environment.
Please suggest a way out so I can call the function from octave. The octave function is just multiplying the numbers.
In Linux distribution:
command : sudo pip install oct2py
Error:
import oct2py
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/oct2py/init.py", line 38, in
octave = Oct2Py()
File "/usr/local/lib/python2.7/dist-packages/oct2py/core.py", line 73, in init
self.restart()
File "/usr/local/lib/python2.7/dist-packages/oct2py/core.py", line 508, in restart
logger=self.logger)
File "/usr/local/lib/python2.7/dist-packages/octave_kernel/kernel.py", line 157, in init
self.executable = self._get_executable()
File "/usr/local/lib/python2.7/dist-packages/octave_kernel/kernel.py", line 432, in _get_executable
raise OSError(msg)
OSError: Octave Executable not found, please add to path or set"OCTAVE_EXECUTABLE" environment variable
Solution
Please install octave using :
command : sudo apt-get install octave
ubuntu#host:~$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import oct2py
I'm running Debian wheezy and have installed mitmproxy from system packages, and pushbullet.py (https://github.com/randomchars/pushbullet.py) using pip, ie.
apt-get install mitmproxy
pip install pushbullet.py
Pushbullet works when I import from python cmdline, like so:
$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pushbullet import PushBullet
>>> pb=PushBullet(myapikeyremoved)
>>>
However, when I try to import the pushbullet module from within a mitmproxy script, it is unable to find the module.
$ echo "from pushbullet import PushBullet" > mypb.py
$ mitmproxy -s mypb.py
Script load error: Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/libmproxy/script.py", line 48, in load
execfile(path, ns, ns)
File "mypb.py", line 1, in <module>
from pushbullet import PushBullet
ImportError: No module named pushbullet
Now, pip has installed pushbullet.py and its dependencies python-magic, requests, backports.ssl-match-hostname into /usr/local/lib/python2.7/dist-packages/. It seems that cmdline python has found the pip-installed packages, but mitmproxy is not able to for some reason.
So, I've tried to add the path via PYTHONPATH or via system path, but I think I must still be doing something wrong.
$ cat mypb.py
import sys
sys.path.append('/usr/local/lib/python2.7/dist-packages')
from pushbullet import PushBullet
pb=PushBullet(myapikeyremoved)
$ mitmproxy -s mypb.py
Script load error: Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/libmproxy/script.py", line 48, in load execfile(path, ns, ns)
File "mypb.py", line 4, in <module>
pb=PushBullet(myapikeyremoved)
File "/usr/local/lib/python2.7/dist-packages/pushbullet/pushbullet.py", line 26, in __init__
self.refresh()
File "/usr/local/lib/python2.7/dist-packages/pushbullet/pushbullet.py", line 223, in refresh
self._load_devices()
File "/usr/local/lib/python2.7/dist-packages/pushbullet/pushbullet.py", line 32, in _load_devices
resp_dict = resp.json()
TypeError: 'dict' object is not callable
Can anyone shed light on why everything works in via cmdline python and fails when loaded as a script from within mitmproxy, and how to fix it? How should modules installed via pip be loaded?
Thanks to Christian Rapp's comments, I looked further into why mitmproxy's libmproxy was being loaded from /usr/lib/python2.6. It turns out that (at least on the debian wheezy package), the mitmproxy shebang explicitly specifies python2.6:
$ head -1 /usr/bin/mitmproxy
#! /usr/bin/python2.6
That explains why mitmproxy fails to find the pushbullet module; it is looking in the 2.6 directories instead.
I guess that the "TypeError: 'dict' object is not callable" error when I explicitly loaded the module is also because pushbullet relied on some feature of python 2.7.