I'm developing plugin Nrpe in Python.
When i try to execute my code it works well on my machine. But when the NRPE execute it, an error occurs : 'No Module named pycurl'
I'm working on CentOs6.10 with Python 3.4 and i've installed pycurl with easy-install, the path to pycurl.py is /usr/lib/python3.4/site-packages//usr/lib/python3.4/site-packages/pycurl.py
And my PYTHONPATH = ['/usr/local/bin', '/usr/lib64/python34.zip', '/usr/lib64/python3.4', '/usr/lib64/python3.4/plat-linux', '/usr/lib64/python3.4/lib-dynload', '/usr/lib64/python3.4/site-packages', '/usr/lib/python3.4/site-packages']
I hope somebody could help me ?
Thanks !
You probably need something like:
python3 -m pip install pycurl
You may want to use: python3 -m pip install --user pycurl
or a virtual environment.
pycurl doesn't come with python. You have to install it with pip from pypi.
Related
I'm trying to install: https://github.com/rozzac90/pinnacle.git from source.
If I type sudo python setup.py install (or sudo python setup.py configure) I get:
import requests
ImportError: No module named requests
The module is installed, I'm sure. It is in the list of conda installed packs. Also, if I try to import it in other scripts, and
python
>>> import requests
>>>
with both python 2 and python3. I get no errors.
I also removed it and installed it again. Same results.
I am using Anaconda with a python3 environment. (I get the same errors in python 2, though.) So I can't use pip commands. I'm running a lubuntu machine, latest version.
Ideas anyone? Thanks in advance !
A suggested answer :
The solution was to run the script in the folder where setup.py is located, in general :
Try with
sudo /[annaconda_python_path]/python setup.py install
Make sure the right environment is active in the terminal.
I recently installed psycopg2 to my computer using macport. I followed the instructions on the Psycopg2 website:
sudo port install py27-psycopg2
When I used
port install
, psycopg2 was listed as successfully installed by macport.
However, whenever I type
import psycopg2
in python, it also give me the errors that there is no such modules in python. I am a novice in computer science. I looked up some questions kind of remsemble mine, but I could figure out what is going on. I hope everyone can help me out with this. I really appreciate your help and your time.
do
$ sudo port select --list python
This will list all the python installations. e.g:
none
python26-apple
python27 (active)
python27-apple
python33
python34
Now select the python27 that is installed by MacPorts:
sudo port select --set python python27
Now do
which python
For me, macports installed python at
/opt/local/bin/python
Try installing psycopg2 with python's native package manager 'pip', you've already got python installed on your mac, so typing :
pip install psycopg2
directly into your terminal's command line will install the module in the same python stack you are using to run the rest of your program.
If pip is not working see this answer to install it :
How do I install pip on macOS or OS X?
I get this error when running code, so it appears that requests hasn't installed properly. I am running Windows 7 32-bit system with Python 3.3.
When I go into 'Programs and Features' in windows it shows up as installed.
I installed this program from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and I have also downloaded the requests folder and tried installing it this way, I can't seem to get this to work.
I have visited ImportError: No module named 'requests' already, but I didn't find this helped at all.
I keep seeing the following statement, but I am uncertain of how to run this?
$ python setup.py install
Please help!?!
The answer there is clear. But let me explain to you as good as I can. This error comes because requests module is not installed in your system
Download the requests module to your system from here
And extract it. Go to your command prompt/terminal and reach to the folder you downloaded.There, you will see setup.py, the file that you need to execute to install the requests module.
python setup.py install
Installs the requests module
This line:
$ python setup.py install
It's a command line in a terminal in Linux or the alike. My guess is that you could do the same opening a terminal in Windows pressing the start key and typing 'cmd', without quotes of course. If you had python already install the %PATH% variable should be set up properly and it should just run. Well, perhaps you need to go to the same folder as the setup.py using
> cd path_to_file
And then,
> python setup.py install
I hope it helps. Let me know otherwise.
If you are using Ubuntu, there is need to install requests
run this command:
pip install requests
if you face permission denied error, use sudo before command:
sudo pip install requests
I use Mac OS X Lion and Python 2.7. I am new to python. Can anyone tell me how to import AppKit and PyObjC to Python. But i get the errors when trying to import Import Error: No module named AppKit or 'Import Error: No module named PyObjC.
Trying easy_install does not help either.
What can i do to import these 2 modules?
If not already installed, install pip by running:
sudo easy_install pip
Then run:
## install for all users
sudo pip install pyobjc
or
## install for current user only
pip install pyobjc --user
NOTE: the general recommendation is to avoid using the system python, and use instead a user-maintained version, for example installed via brew install python3, macports, conda or whatever you already use for third party dependencies.
If you're on Mac it could be you're using the incorrect pip version, try sudo pip3 install -U pyobjc that solved it for me.
This a good guide on how to install PyObjc: http://ioanna.me/2009/09/installing-pyobjc-xcode-templates-in-snow-leopard/
When I was trying to install PyObjc I found it quite hard, but after a while, (and lots of google searches) I got it working.
Edit
I've found a more modern guide on how to do this. Download the templates and put them into your ~/Library/Developer/Xcode/Templates/ directory, and everything should work correctly.
If you are using PyCharm, you should install PyObjC package manually within it because of venv I guess. This was the only working solution for me.
In my case none of them worked. I was using Anaconda in my mac, later I discovered that the main issue with the Anaconda. Then I installed PyObjC with it's all supporting libraries inside Anaconda in a specific Environment.
I run the command line by clicking the Environment play icon and run my script.
It worked without any issues :)
I have Python 2.4 and 2.7 on my Centos server.
I would like to use PyCURL under Python 2.7.
I ran yum install pycurl and it appeared to install but when I attempt to import PyCURL it works fine for Python 2.4 but not for 2.7.
Can anyone advise how it is possible to install PyCURL (or any other Python extension for that matter as I can see this being an issue in future) to a specific version of python.
Thanks
C
------ SOULTION (thanks gjallar) ----------
Instead of using YUM I downloaded and installed PyCurl by running the setup.py file using the python version I wanted i.e.
sudo python2.7 setup.py install
This still didn't work as I was getting an error saying I had the wrong version of libcurl
To ressolve this I downloaded the latest curl version from http://curl.haxx.se/download.html and installed with the instructions here: http://curl.haxx.se/docs/install.html
Sadly, this still didn't work as when I tried to import pycurl in python I got:
File "<stdin>", line 1, in <module>
ImportError: libcurl.so.4: cannot open shared object file: No such file or directory
This was in turn ressolved by carrying out the command:
export LD_LIBRARY_PATH=/usr/local/lib
As suggested in the post:
Why can't Python find shared objects that are in directories in sys.path?
(Thanks Vinay)
Now it works.
One possible route you can take to install a certain application for a specific python version is to install pip using the specific python version and the use pip to install pyCURL.
In your case this should work by installing pip using python2.7 and then run pip install pycurl:
Install pip via distribute running the setup.py file with your python2.7 interpreter.
This requires pycurl to be available in PyPi - otherwise (if the pycurl download contains a setup.py) simple run the setup.py file using the interpreter you want to install it for.