I have been trying to install tweepy on OSx via
pip install tweepy
I have already installed pip, but I am getting this strange error message I haven't come accross before and, obviously Tweepy doesn't import at all (because it hasn't installed).
I get the following error message:
error: could not create '/Library/Python/2.7/site-packages/tests': Permission denied
Is there any way that I can grant permission? What am I doing wrong?
Thanks in advance
Extra information: running Python 2.7 if you couldn't tell from the path
As mentioned by Alko, you need root access to write to the directory where pip stores the packages.
You can type:
sudo su
in the terminal and then type:
pip install tweepy
Alternatively, you can use virtualenv:
"What if you can't install packages into the global site-packages directory? For instance, on a shared host.
In all these cases, virtualenv can help you. It creates an environment that has its own installation directories, that doesn't share libraries with other virtualenv environments (and optionally doesn't access the globally installed libraries either)."
Basically, it will allow you to create isolated environments for each of your python projects and will allow you to sidestep the permissions issue you are having.
For a good explanation see: Installing Python on Mac OS X: virtualenv
Related
pip install SpeechRecognition
I try to install SpeechRecognition with the command above but i get this message:
from http import cookies
ImportError: cannot import name 'cookies' from partially initialized module 'http' (most likely due to a circular import) (C:\Users\52644\venv\Lib\site-packages\django\http\__init__.py)
Can someone help me with this please.
I already solved it, in the directory variables I had one that I created that was named PYTHONPATH, you donĀ“t have to do that because python does that automatically, so you would have literally kind of a copy of all the files, that was producing the error. So, i just deleted that variable and it worked. Thanks fo the ones that answered.
While working with a large framework as Django one must always work in a virtual environment. Please check if you have your virtual environment activated. If not, then follow the steps:
cd your_working_directory
virtualenv environment_name where environment_name can be any name you want.
environment_name/Scripts/activate if on Windows
Or environment_name/bin/activate if on MacOS
Then after activating the environment you can install all the dependencies using pip. i.e pip install django or pip install SpeechRecognition
I have no root access.
I followed this tutorial http://ernie55ernie.github.io/python/2016/11/11/install-python-packages-for-local-user-without-sudo.html to install python without sudo access.
It worked fine, but then when I try to install a package I get the _ctypes error, which I know is due to the "libffi-dev" package missing (on debian).
I can't install this package, so I downloaded version 3.3 from their ftp servers and built it in python/libffi.
I then set env variables like so:
export LD_LIBRARY_PATH=$HOME/python/libffi/lib64
export LD_RUN_PATH=/$HOME/python/libffi/lib64
export PKG_CONFIG_PATH=$HOME/python/libffi/lib/pkgconfig
After coming across this thread: https://www.reddit.com/r/linuxquestions/comments/c5wxh0/help_with_error_on_install_of_python37_from/
However, my pip install is still not working. How can I get around this? Is there an argument I can specify to pip to use my local version of libffi?
When I try to do python manage.py syncdb in my Django app, I get the error ImportError: No module named azure.storage.blob. But thing is, the following packages are installed if one does pip freeze:
azure-common==1.0.0
azure-mgmt==0.20.1
azure-mgmt-common==0.20.0
azure-mgmt-compute==0.20.0
azure-mgmt-network==0.20.1
azure-mgmt-nspkg==1.0.0
azure-mgmt-resource==0.20.1
azure-mgmt-storage==0.20.0
azure-nspkg==1.0.0
azure-servicebus==0.20.1
azure-servicemanagement-legacy==0.20.1
azure-storage==0.20.3
Clearly azure-storage is installed, as is evident. Why is azure.storage.blob not available for import? I even went into my .virtualenvs directory, and got in all the way to azure.storage.blob (i.e. ~/.virtualenvs/myvirtualenv/local/lib/python2.7/site-packages/azure/storage/blob$). It exists!
What do I do? This answer here has not helped: Install Azure Python api on linux: importError: No module named storage.blob
Note: please ask for more information in case you need it
I had a similar issue. To alleviate that, I followed this discussion here: https://github.com/Azure/azure-storage-python/issues/51#issuecomment-148151993
Basically, try pip install azure==0.11.1 before trying syncdb, and I'm confident it will work for you!
There is a thread similar with yours, please check my answer for the thread Unable to use azure SDK in Python.
Based on my experience, Python imports the third-party library packages from some library paths that you can check them thru codes import sys & sys.path in the python interpreter. So you can try to dynamically add the new path contains the installed azure packages into the sys.path in the Python runtime to solve the issue. For adding the new library path, you just code sys.path.append('<the new paths you want to add>') at the front of the code like import azure.
If the way has not helped, I suggest you can try to reinstall Python environment. On Ubuntu, you can use the command sudo apt-get remove python python-pip & sudo apt-get install python python-pip to reinstall Python 2.7 & pip 2.7.(Note: The current major Linux distributions use Python 2.7 as the system default version.)
If Python 3.4 as your runtime for Django, the apt package names for Ubuntu are python3 and python3-pip, and you can use sudo pip3 install azure for Python 3.4 on Ubuntu.
Any concern, please feel free to let me know.
I am writing a python tool that should get information from Jira. I wanted to use Python-Jira but cannot install it properly. I am using (have to use) python 2.7 which doesn't come with pip and I cannot install pip because I do not have local admin rights (and won't get them without hassle).
Is there a way to install/use python-jira without the pip installation process? I tried copying the jira package to the site-packages folder but it seems I run into dependency problems ('ImportError: No module named six.moves' when I try import Jira from jira) which to resolve it seems I have to follow the pip installation process.
Thanks for your help.
Install Virtualenv and you will have your own version of Python and Pip, so you should be able to install jira-python properly.
There is a lot of guides how to do it.
For Linux I recommend this one.
General Python Guide
Be forewarned, issues related to installing Python make me nervous. I spent an entire morning panicking what would happen when I would install Python 3.
Now on to the task. My computer is an Apple. I would like to add a python module that I have downloaded from the internet. How do I install the package?
I tried 'python setup.py install' but received an error:
error: could not create '/Library/Python/2.7/site-packages/bs4': Permission denied
Please help. Thank you.
Alternatively to installing with elevated privileges, you could also use virtualenv to create a self-contained environment in user space, then install things to that with regular user privileges. This also has other benefits over installing to the system Python, such as keeping your dependencies clear, and not accidentally breaking your system install with some funky package.
You need to use elevated privileges to do this by using sudo
sudo python setup.py install