So I'm trying to import AppKit into my python project. I am using pyCharm, but every time I try to import, I get the following error message:
You are using pip version 6.0.8, however version 6.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting AppKit
Using cached AppKit-0.2.8.tar.gz
Collecting flask (from AppKit)
Using cached Flask-0.10.1.tar.gz
Collecting pygobject (from AppKit)
Using cached pygobject-2.28.3.tar.bz2
Traceback (most recent call last):
File "<string>", line 20, in <module
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3p/csss5m7x30ldjd4z0xt6sg380000gn/T/pycharm-packaging0.tmp/pygobject
I've tried running the command directly through terminal etc, and I have upgraded my version of pip to 6.1.1 as well.
Not sure if this is a really beginner's mistake that I am making, or if there is something wrong with my installs of pip or python.
Any advice would be great, thanks :D
First, "importing" and "installing" are not the same thing. Installing is how you get a PyPI package, and all of its dependencies, onto your computer, so you can use its modules. Importing is how you use a module that's already on your computer.
Second, there are two different things named AppKit, and I think you've gotten them confused.
If you're on a Mac, you're almost certainly trying to use import AppKit to get the PyObjC wrapper around the native Cocoa framework named AppKit. If you don't already have PyObjC installed (I believe it comes with Apple's built-in Python on OS X 10.8-10.10), you get it with pip install PyObjC, not pip install AppKit.
If you're on Linux or FreeBSD or similar, you may be trying to import AppKit to get the AppKit framework for building GNOME GUI apps out of HTML and JavaScript. (Although this is in early stages, so I don't think you actually do want it.) For that, pip install AppKit is what you want. But you may need to install some system packages for GNOME development first with apt-get or urpmi or whatever's appropriate for your system.
If you're on Windows or something else, neither one of these makes sense, so… hopefully you're not. :)
Related
I've recently decided to learn OpenGl in python.
I installed PyOpenGL using pip3 install PyOpenGl PyOpenGl_accelerate. I was then about to follow a
tutorial for PyOpenGL. The first item was to install PyOpenGLContext.
I tried to install PyOpenGLContext with both pip3 install OpenGLContext and pip3 install PyDispatcher PyVRML97 OpenGLContext and both gave me the same error:
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/3r/xfny397j6j98y1sjgh_s574m0000gn/T/pip-build-o7zx54vx/OpenGLContext/setup.py", line 10
except ImportError, err:
^
SyntaxError: invalid syntax
So, there's a syntax error there. How do I get around this? If you need more information, please let me know. I am trying to install this on a MacBook Pro (2013) version for Python3.5.
It should work if you download and install the wheel from Unofficial Windows Binaries for Python Extension Packages:
Download the OpenGLContext‑2.3.0‑py2.py3‑none‑any.whl installation file to a an arbitrary directory.
cd to that directory in a command line and install using pip install OpenGLContext‑2.3.0‑py2.py3‑none‑any.whl
It looks like OpenGLContext has not been updated in a while, and thus is not compatible with Python 3.5.
Having a look at https://pypi.python.org/pypi/OpenGLContext yields that the last update was in 2014.
You probably want to either use an older python version, or a different library.
I'm new to Linux and I'm trying to install packages through a Makefile so users can run my Python 3 program.
sudo pip install python3-weather-api
However, even after uninstalling a previously installed version, the package seems to be going to the 2.7 version of Python.
Requirement already satisfied: python3-weather-api in /usr/local/lib/python2.7/dist-packages
Then, when I run the program, it can't find the module (it works locally in Python 3 just fine).
SystemExit: 1
Traceback (most recent call last):
File "project.py", line 11, in <module>
from weather import Weather
ImportError: No module named 'weather'
Is there a way I can point the original installation so when I run python3 project.py it can find the module?
Thanks very much!
I would recommend you to use pyenv to manage your Python installations, but, for now, try to run:
sudo pip3 install python3-weather-api
I've been trying for a couple of hours already. It seems IDLE can't find any third-party module. I am a Python beginner.
Here is some info about my system:
OSX version: 10.11.5
python version: Python 2.7, Python 3.4, Python 3.5
The initial installation using pip (among other methods) seems to work fine. When I repeat the installation, terminal responds with:
Requirement already satisfied (use --upgrade to upgrade): pyperclip in
./anaconda/lib/python3.4/site-packages
However, when I go to IDLE (Python 3.4) and try to import the module, IDLE responds with:
Traceback (most recent call last): File "", line 1, in
import pyperclip ImportError: No module named 'pyperclip'
I have read that it may have something to do with my PATH or some virtual environment. I’ll be frank, I’m not sure what to make of these as they seem beyond my current ability.
This inability to import modules is becoming an almost insurmountable roadblock to advancing with Python. If you can offer any ideas on what I can do or can ELI5 the solution, I am forever in your debt?
It seems you are using conda, but you are trying to install the pyperclip module with pip. Have you tried running conda install pyperclip?
As stated here:
Because Conda introduces a new packaging format, you cannot use pip and Conda interchangeably; pip cannot install the Conda package format. You can use the two tools side by side but they do not interoperate either.
I'm trying to install and use python for the first time, but I'm having problems using extern librairies.
/usr/bin/python /path/core/__init__.py
Traceback (most recent call last):
File "/Users/fabienlamarque/Downloads/RedditAPI/core/__init__.py", line 6, in <module>
import requests
ImportError: No module named requests
Source code :
import requests
r = requests.get(r'path/.json')
As I surfed around trying to find answers, I found some people telling me to use pip, I indeed used pip and pip3 (with python 2.7.5 and python 3.4.2), the answer is always:
$ pip install requests
Requirement already satisfied (use --upgrade to
upgrade): requests in /usr/local/lib/python2.7/site-packages
Cleaning up...
Which seems like a good thing, I forced the reinstallation of the module several times, but I always have the same problem. My IDE tells me "No module named 'requests'" though.
What did I miss?
Thanks
I see /usr/bin/python in there so it's a *nix variant.
you will probably find that which python and which pip point to different locations.
You can just download the source and use python setup.py install assuming that your user has write privilages to the puthon site-packages dir.
Virtualenv for virtualenvironments of even better, conda environments is soemthing I highly suggest learning early on to avoid these headaches on your leaning path.
I'm very new to python and any non-basic computer functions in general, but I'm having a very basic problem and I can't figure out how to fix it. Any time I download a module from the internet and try to import it in python, I get an error message. For example, I just downloaded wxPython after being instructed to do so on a tutorial program for Python I've been using, and after entering "import wx" I got:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import wx
ImportError: No module named wx
How do I fix this so that python can find modules I download?
Thanks!!
Python version 2.7.3, and I downloaded wxPython from the download link on the website. Another thing I noticed: whenever I type in python setup.py install in the Terminal, I get:
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
can't open file 'setup.py': [Errno 2] No such file or directory
Which seems to be another huge problem?
There are a few things you need to do to actually debug this:
Run python and check what version you are running.
type where python and figure out if you have multiple versions of python running at once.
With pip or easy_install, read the output to check where they are installing packages. It's somewhat likely that they are installing to the system-wide Python 2.6, as opposed to the version that you want it to be installed to (Python 2.7).
If you find any packages installed in the wrong place with 3, uninstall them with pip uninstall <packagename> and then specifically reinstall them to 2.7 with easy_install-2.7 or pip-2.7 install. If you don't see the option for easy_install-2.7 or pip-2.7, you need to install distribute and run its setup.py file with the specific version of Python you are using.
Make sure you are actually in the directory when running setup.py. For example, to install distribute, you need to cd into the appropriate directory to install.
Finally, a separate note: it's far easier to install packages with easy_install or pip, as opposed to downloading them separately. You should try doing that first. Again, distribute has more info.