installing pyobjc on mac osx 10.9 - python-2.7

I'm trying to download pyobjc on my mac, which runs on 10.9.3. I've tried using easy_install, pip, and manual install. I have setuptools installed with Xcode 5.
When I use easy_install, pip, or manual install I get the error: AttributeError: 'module' object has no attribute '_install_lib' right before it quits, along with other errors before this. For easy_install I type the following line in the terminal:
easy_install -U pyobjc
and for pip I use:
pip -U pyobjc
for manual install I use:
python setup.py install

I too was having this problem, also described here. It seems to be a problem with setuptools. I was able to successfully install PyObjC by reinstalling setuptools first, i.e.:
$> sudo pip uninstall setuptools
$> pip install setuptools
$> pip install pyobjc
Hope that helps.

I think this was fixed in pyobjc 2.5.1.

Related

pip is error,TypeError: __call__() takes exactly 2 arguments (1 given)

system
centos 7.2
Python 2.7.5
install
I install webhook
pip install webhook
### but hava error,then
yum install python-devel -y
## go on,pip doesn't workding
pip
error
Enter the command contain pip.Then
[root#location src]# pip
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/usr/lib/python2.7/site-packages/packaging/requirements.py", line 59, in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)
So,what should I do?!
I had the same problem on a fresh virtualenv and apparently this is a conflict between the version requirements for packaging, pip and pyparsing with the new setuptools. What worked for me was to pin down the old one.
pip install setuptools==33.1.1
Update:
As another answer pointed out, pip has already fixed the bug, so you should try upgrading it instead of using the workaround above.
python -m pip install --upgrade --force pip
UPDATE:
Please see the solution lower in this thread by Pedro Werneck instead of this one. It's the correct way to solve the problem.
Preface: I do not recommend this!
This seems to work, but I have no idea what the consequences could be. This is cargo cult programming at its best! I'm only adding it here in case it can help someone in a bind.
I made changes to the file requirements.py where the error occurred. For #hysg, that would be this file:
/usr/lib/python2.7/site-packages/packaging/requirements.py
On me on OS X, it's here:
/Library/Python/2.7/site-packages/packaging/requirements.py
I modified the the offending line by removing the parentheses for the call to MARKER_EXPR, as demonstrated below:
#MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
MARKER_EXPR = originalTextFor(MARKER_EXPR)("marker")
And that worked.
Again, please be careful! I don't know what I'm doing and this could potentially cause more harm than good.
this is work well:
python -m pip install --upgrade --force pip
pip install setuptools==33.1.1
This is what worked for me:
pip install setuptools==33.1.1
It downgraded setuptools from 35.0.1 to 33.1.1 and pyparsing 1.5.7 installed!
Use the following command to upgrade pip, which has the bug fixed:
python -m pip install --upgrade --force pip
It worked for me (centos 7, python 2.7).
For more details: GitHub
I applied the fix
pip install setuptools==33.1.1
and it solved the problem for OSX 10.10.5 (Yosemite)
I ran into the same problem on a new virtualenv trying to install. I'm running python 2.7.11 and found the two commands belows solve the versioning problem with setuptools:
This forces a pip upgrade, which has a fix for the bug, but doesn't reinstall setup tools, so I was still running on setuptools version 35.0.1
python -m pip install --upgrade --force pip
This sets setuptools to an older version.
pip install setuptools==33.1.1
After this, I successfully installed my requirements.
None of the other uninstall/reinstall/force answers worked for me, but on OS X 10.10.5 with the system Python 2.7.10, I was able to do:
pip uninstall packaging pip
easy_install pip # this installed pip 1.4.1
pip install --upgrade pip # and this upgraded to the current pip
and I was then able to import pkg_resources without a problem.
Should really learn to stop messing with the system Python…
Actually, I had a problem that OS/system which means root, not sudo, has been the owner of the pip2 package. But after I had executed this command:
sudo apt-get remove python-pip
it worked like a charm.
Noting, of course that I have a debian distribution.
And then I used what Pedro suggested:
sudo pip install setuptools==33.1.1
It worked for me too (centos 7, python 2.7).
python -m pip install --upgrade --force pip
pip install setuptools==33.1.1

pip command by default using python 3...how to change it to python 2?

I am using macOS Sierra 10.12 and after I upgraded my OS I can no longer install packages for python 3 using pip. Before I used to use pip for python2 and pip3 for python 3 as I have both versions of Python. But now I can no longer use pip to install libraries for python2.
Can anyone help me how can I change my default pip installer to python2? So that I can just use pip install in order to install for python 2.
For your information - when I only type python on terminal it says my default is python 2.7.
on running
which pip
I got /usr/local/bin/pip
Which meant it was pointing to pip2
To change default pip to pip3, run
sudo ln -s /usr/local/bin/pip3 /usr/local/bin/pip
install pip for Python2.7 with easy_install:
sudo easy_install-2.7 pip
now you can use pip for the same specific version of Python:
sudo pip2.7 install BeautifulSoup

Pip installation bug

So I tried to install pip using the get-pip.py file, and when I ran the file, terminal told me I already had pip installed on 2.7. However, when I try to find the version of my pip, terminal tells me pip doesn't exist and points to a version of 3.5 I have installed. Clearly my issue is that I have pip installed on v2.7 but the pip command is linked to v3.5. Any clues on how to fix?
Here's a picture of my terminal output:
To install a package in a particular version of python, use the following commands always:
For python 2.x:
sudo python -m pip install [package]
For python 3.x:
sudo python3 -m pip install [package]
This should resolve the doubt of which python version is the given package getting installed for.
Note: This is assuming you have not created aliases for the python command

pip, easy_install commands not working in Ubuntu. Python 2.7 and 3.4 are installed

I'm fairly new to python. I'm using Ubuntu 14.04 and have both python 2.7.6 and python 3.4.0 installed. I was trying to install BeautifulSoup but couldn't because I get an error saying
The program 'pip' is currently not installed.
I found that it comes bundles with python 3.4. I tried to install pip using sudo easy_install pip as mentioned in another question on stackoverflow. But this gives an error sudo: easy_install: command not found.
What is the problem?
pip appears to have turned into python -m pip (in your case, python3 -m pip, as Ubuntu's keeping the 2.x line available as python) in Python 3.4.
easy_install for Python 2.7 comes as part of the python-setuptools package. Once installed, running easy_install pip would install pip for your Python 2.7 installation's use.
How aboutapt-get install python-pip? At least, Debian official repository has python-pip even from wheezy.
Unfortunately, effective as of April 2018, python-setuptools no longer ships with easy_install, as per Matthias's update:
https://ubuntu.pkgs.org/18.04/ubuntu-main-i386/python-setuptools_39.0.1-2_all.deb.html
However, you can still compile from the source code yourself, and it does work. I just tried it with sudo easy_install shodan, and it ran successfully.
git clone https://github.com/pypa/setuptools.git
cd ./setuptools
python3 bootstrap.py
sudo python3 setup.py install
Hope this helps.

Installing MySQL-python for Django

I've just learned how to use virtualenv and I installed Django 1.4.5. I'm assuming that the virtualenv created a clean slate for me to work on so with the Django 1.4.5 installed, I copied all my previous files into the virtualenv environment.
I tried to run the server but I get an error saying "no module named MySQLdb". I think this means that I forgot to install MySQL-python. I tried to install it via
pip install MySQL-python
But I get this error
Downloading/unpacking MySQL-python
Running setup.py egg_info for package MySQL-python
The required version of distribute (>=0.6.28) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
(Currently using distribute 0.6.24 (/home/bradford/Development/Django/django_1.4.5/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg))
Complete output from command python setup.py egg_info:
The required version of distribute (>=0.6.28) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
(Currently using distribute 0.6.24 (/home/bradford/Development/Django/django_1.4.5/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg))
----------------------------------------
Command python setup.py egg_info failed with error code 2 in /home/bradford/Development/Django/django_1.4.5/build/MySQL-python
Not quite sure how to go about fixing this problem =/ any help much appreciated!
I recently had exactly this issue (just not in relation to Django). In my case I am developing on Ubuntu 12.04 using the default pip and distribute versions, which are basically a little out of date for MySQL-python.
Because you are working in an isolated virtualenv, you can safely follow the suggested instruction without affecting your Python installation.
So you can...
workon your_virtualenv #activate your virtualenv, you do use virtualenvwrapper, right?
easy_install -U distribute #update distribute on your virtualenv
pip install MySQL-python #install your package
If for some reason upgrading distribute is not an option, you could try installing an older version of MySQL-python as follows (you'd have to check this version is compatible with your version of Django):
pip install MySQL-python==x.y.z #where x.y.z is the version you want
Spent an hour looking through stackoverflow. Evntually found answer in the other question. This is what saved me:
sudo apt-get install libmysqlclient-dev
mysql_config goes with the package.
When doing in a virtualenv :
pip install MySQL-python
I got
EnvironmentError: mysql_config not found
To install mysql_config, as Artem Fedosov said, first install
sudo apt-get install libmysqlclient-dev
then everything works fine in virtualenv
MySQL driver for Python (mysql-python) needs libmysqlclient-dev. You can get it with:
sudo apt-get update
sudo apt-get install libmysqlclient-dev
If python-dev is not installed, you may have to install it too:
sudo apt-get install python-dev
Now you can install MySQL driver:
pip install mysql-python
Here is a more detailed documentation for MySQL in Django:
http://codex.themedelta.com/how-to-install-django-with-mysql-in-a-virtualenv-on-linux/
I had to do this:
pip install mysql-python
inside the virtualenv
The commands are always run in ubuntu:
easy_install -U distribute
later
sudo apt-get install libmysqlclient-dev
and finally
pip install MySQL-python
The suggested solutions didn't work out for me, because I still got compilation errors after running
`$ sudo apt-get install libmysqlclient-dev`
so I had to run
apt-get install python-dev
Then everything worked fine for me with
apt-get install python-dev
Try this:
Version Python 2.7
MySQL-python package, you should use either MySQL_python‑1.2.5‑cp27‑none‑win32.whl or
MySQL_python‑1.2.5‑cp27‑none‑win_amd64.whl depending on whether you have installed 32-bit or 64-bit Python.
pip install MySQL_python‑1.2.5‑cp27‑none‑win32.whl
if you are using mysqlclient package, then use
mysqlclient‑1.4.6‑cp27‑cp27m‑win32.whl or
mysqlclient‑1.4.6‑cp27‑cp27m‑win_amd64.whl
pip install mysqlclient‑1.4.6‑cp27‑cp27m‑win32.whl
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient