pip install tweepy on mac is not working - python

These are the versions that I am working with
$ python --version
Python 2.7.10
$ pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)
Ideally I should be able to install tweepy. But that is not happening.
$ pip install tweepy
Collecting tweepy
Using cached tweepy-3.5.0-py2.py3-none-any.whl
Collecting six>=1.7.3 (from tweepy)
Using cached six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied: requests>=2.4.3 in /Library/Python/2.7/site-packages (from tweepy)
Requirement already satisfied: requests-oauthlib>=0.4.1 in /Library/Python/2.7/site-packages (from tweepy)
Requirement already satisfied: oauthlib>=0.6.2 in /Library/Python/2.7/site-packages (from requests-oauthlib>=0.4.1->tweepy)
Installing collected packages: six, tweepy
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
A bunch of lines deleted for brevity. It finally ends at ...
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-CBvMLu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
Can anyone help?
Update Tried the following as well. But did not solve the problem
$ sudo -H pip install tweepy

Install it with:
sudo pip install tweepy
Looks like a permission problem :)

I got the same problem. The way I solved it was to download python 2.7.13 from the official website and install it. After that, I installed pip with:
sudo easy_install pip
And after that:
pip install tweepy
Hope it is still relevant :)

Related

Error: subprocess-exited-with -error. --python

Error: subprocess-exited-with -error, python setup.py egg_info did not run successfully.
I know that there are some similar questions. But the error still exist after trying those solution. I want to install a model called midi-ddsp and it shows an error.
Requirement already satisfied: music21 in ./Library/Python/3.8/lib/python/site-packages (from midi-ddsp) (7.3.3)
Requirement already satisfied: pandas in ./Library/Python/3.8/lib/python/site-packages (from midi-ddsp) (1.3.3)
Requirement already satisfied: pretty-midi in ./Library/Python/3.8/lib/python/site-packages (from midi-ddsp) (0.2.9)
Requirement already satisfied: mir-eval in ./Library/Python/3.8/lib/python/site-packages (from ddsp==3.2.0->midi-ddsp) (0.7)
Requirement already satisfied: tensorflow-addons in ./Library/Python/3.8/lib/python/site-packages (from ddsp==3.2.0->midi-ddsp) (0.17.1)
Requirement already satisfied: cloudml-hypertune in ./Library/Python/3.8/lib/python/site-packages (from ddsp==3.2.0->midi-ddsp) (0.1.0.dev6)
Collecting crepe>=0.0.11
Using cached crepe-0.0.12.tar.gz (15 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
Because the codes are too long, if I need to paste more, please tell me!
I've tried to upgrade pip, pip3 install midi-ddsp --use-deprecated=legacy-resolver, pip3 install --upgrade setuptools, easy_install -U setuptools and so on. But neither of them could work. Hope someone could help me, thanks!
I tried these from the answers of another question on StackOverflow but didn't work for me
pip install --user pygames
python -m pip install -u pygame --user
(How to solve the "pip install pygame" issue?)
But in the end, I tried along with --pre. This worked
pip install pygame --pre
Output:
PS C:\\Windows\\system32\> pip install pygame --pre
Collecting pygame
Using cached pygame-2.1.3.dev8-cp311-cp311-win_amd64.whl (10.6 MB)
Installing collected packages: pygame
Successfully installed pygame-2.1.3.dev8
I think --pre is used for
The pip install command also supports a --pre flag that enables installation of pre-releases and development releases.
I had the same problem when I tried to import an old requirements.txt.
scipy==1.5.1
I checked it from Pypi, changed to 1.9.1 in requirements.txt,
and it works!
I had a similar problem on updating systemd-python with
python3.8 -m pip install --upgrade systemd-python
The error message began with these words:
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
The lines following were quite telling:
Cannot find libsystemd or libsystemd-journal:
Package libsystemd was not found in the pkg-config search path.
Even though the package libsystemd was installed, Python did not find it. I have learnt that often you can solve this "not finding an installed package" by installing the corresponding dev package; in this case it is libsystemd-dev.
After installing the libsystemd-dev the command python3.8 -m pip install --upgrade systemd-python ran smoothly.
I got this exact same error when trying to run:
pip install dotenv
After a lot of hunting around, I realised I got the package name wrong. The correct command was:
pip install python-dotenv
Maybe try googling "pip your-package-name" to find the PyPi page for your package and double check you are using the correct name? It is annoying that the pip error message was not more descriptive.

Trouble installing pyautogui on windows 10

I'm having trouble installing pyautogui, it gives me the following error. By the way, I'm new to python so if I'm not understanding something please explain it to me.
Thanks in advance!
pip install pyautogui
Collecting pyautogui
Using cached https://files.pythonhosted.org/packages/f0/76/7a0ec1013bc3559b7438f6773cba05ffaec600b8989be2d621a144e39b50/PyAutoGUI-0.9.53.tar.gz
Collecting pymsgbox (from pyautogui)
Collecting PyTweening>=1.0.1 (from pyautogui)
Using cached https://files.pythonhosted.org/packages/e9/4f/acb6a2d95260a4377885e40c167fd5df587630696a6a7934675f86aebb06/pytweening-1.0.4.tar.gz
Collecting pyscreeze>=0.1.21 (from pyautogui)
Collecting pygetwindow>=0.0.5 (from pyautogui)
Using cached https://files.pythonhosted.org/packages/e1/70/c7a4f46dbf06048c6d57d9489b8e0f9c4c3d36b7479f03c5ca97eaa2541d/PyGetWindow-0.0.9.tar.gz
Collecting mouseinfo (from pyautogui)
Using cached https://files.pythonhosted.org/packages/28/fa/b2ba8229b9381e8f6381c1dcae6f4159a7f72349e414ed19cfbbd1817173/MouseInfo-0.1.3.tar.gz
Collecting Pillow>=6.2.1; python_version == "3.8" (from pyscreeze>=0.1.21->pyautogui)
Using cached https://files.pythonhosted.org/packages/8f/59/97618ad67fc0639ed588c60cfe9d91417f7bae8c87bbe7c7784b0ffdb9f1/Pillow-9.2.0-cp38-cp38-win_amd64.whl
Collecting pyrect (from pygetwindow>=0.0.5->pyautogui)
Using cached https://files.pythonhosted.org/packages/cb/04/2ba023d5f771b645f7be0c281cdacdcd939fe13d1deb331fc5ed1a6b3a98/PyRect-0.2.0.tar.gz
Collecting pyperclip (from mouseinfo->pyautogui)
Using cached https://files.pythonhosted.org/packages/a7/2c/4c64579f847bd5d539803c8b909e54ba087a79d01bb3aba433a95879a6c5/pyperclip-1.8.2.tar.gz
Installing collected packages: pymsgbox, PyTweening, Pillow, pyscreeze, pyrect, pygetwindow, pyperclip, mouseinfo, pyautogui
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\program files\python38\Lib\site-packages\pymsgbox'
Consider using the --user option or check the permissions.
WARNING: You are using pip version 19.2.3, however version 22.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
The error actually gives you your answer by their recommendation to use the --user option. I run into this as well, if you want to install something without admin privileges. Just add the --user flag to the end of your pip command. This will limit the installation to the current user and not require administrator privileges.
Try this:
pip install pyautogui --user
The second error also gives you the answer of what to do.
pip install --upgrade pip
or, if needed...
pip install --upgrade pip --user

No module named 'OpenSSL' in python

I search on google how to add OpenSSL in python. The command is easy to run.
pip install pyOpenSSL or pip3 install pyOpenSSL. I don't know if my OpenSSL is already installed. I have this response when I installed openssl.
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: pyopenssl in /usr/local/lib/python3.9/site-packages (20.0.1)
Requirement already satisfied: cryptography>=3.2 in /usr/local/lib/python3.9/site-packages (from pyopenssl) (36.0.1)
Requirement already satisfied: six>=1.5.2 in /usr/local/lib/python3.9/site-packages (from pyopenssl) (1.16.0)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.9/site-packages (from cryptography>=3.2->pyopenssl) (1.15.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.9/site-packages (from cffi>=1.12->cryptography>=3.2->pyopenssl) (2.21)
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
this is my index.py code
import base64
import json
import requests
from OpenSSL import crypto
when I run this command python3 index.py. I always get this error
ModuleNotFoundError: No module named 'OpenSSL'
May i know what's the issue in my setup? Im new in python code. My python version is 3.10.0
It looks like you have pyopenssl installed for a Python 3.9 installation (look at the path: /usr/local/lib/python3.9), but you are trying to run with a Python 3.10 installation.
Use the pip from your Python 3.10 installation to install the required packages. python3 -m pip install pyOpenSSL should do that, regardless of what the standalone pip command resolves to.

Having trouble installing PyTorch

I'm having trouble installing PyTorch.
C:\Users\myself>pip install torch
Collecting torch
Using cached torch-1.7.1-cp38-cp38-win_amd64.whl (184.0 MB)
Requirement already satisfied: numpy in c:\users\myself\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from torch) (1.19.1)
Requirement already satisfied: typing-extensions in c:\users\myself\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from torch) (3.7.4.3)
Installing collected packages: torch
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\myself\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\caffe2\\python\\serialized_test\\data\\operator_test\\learning_rate_adaption_op_test.test_learning_rate_adaption_op_normalization.zip'
WARNING: You are using pip version 20.2.4; however, version 20.3.3 is available.
You should consider upgrading via the 'C:\Users\myself\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip' command.
It says that I'm missing a file in caffe2, but I'm not sure how I can get that file back.
Torch wheel contains caffe2 directory.
1.Try --no-cache-dir option
pip install --no-cache-dir torch
2. Removing the MAX_PATH Limitation
See here 3. Using Python on Windows — Python 3.7.9 documentation. You can find some more detailed discussion here.

cant import sendgrid after pip installing it

I tried using pip install sendgrid, but got this error:
Collecting sendgrid
Using cached https://files.pythonhosted.org/packages/24/21/9bea4c51f949497cdce11f46fd58f1a77c6fcccd926cc1bb4e14be39a5c0/sendgrid-5.6.0-py2.py3-none-any.whl
Requirement already satisfied: python-http-client>=3.0 in /home/avin/.local/lib/python2.7/site-packages (from sendgrid) (3.1.0)
Installing collected packages: sendgrid
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/sendgrid-5.6.0.dist-info'
Consider using the --user option or check the permissions.
I used the --user as suggested and it run ok:
Collecting sendgrid
Using cached https://files.pythonhosted.org/packages/24/21/9bea4c51f949497cdce11f46fd58f1a77c6fcccd926cc1bb4e14be39a5c0/sendgrid-5.6.0-py2.py3-none-any.whl
Requirement already satisfied: python-http-client>=3.0 in /home/avin/.local/lib/python2.7/site-packages (from sendgrid) (3.1.0)
Installing collected packages: sendgrid
Successfully installed sendgrid-5.6.0
However, now, when running IPython, I can't import sendgrid...
ImportError: No module named sendgrid
pip -V = pip 19.0.3
This is a very useful command pip install --ignore-installed <package>
It will make your life easy :)
Solved.
It required another package that I missed: pip install python-HTTP-Client.
After that I no longer needed the --user and the imports worked fine

Categories