I've recently installed the latest version of Py2app on my Mac Os X (10.5.8), and I've watched some tutorials on YouTube such as: http://www.youtube.com/watch?v=Zip9H_dLdhI, and http://www.youtube.com/watch?v=5Ehhts9HhE8, but when I copy their main setup code, it gives me an ImportError:
Traceback (most recent call last):
File "/Users/CarlProject/Rectangles Backup.py", line 7, in <module>
from setuptools import setup
ImportError: No module named setuptools
This is my setup code, copied and edited from the first YouTube video:
"""
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['Rectangles.py']
DATA_FILES = [('', ['fonts'])]
setup(
app = APP,
data_files = DATA_FILES,
setup_requires = ['py2app'],
)
My Python version is 2.7.5, and I'm using Pygame. The Py2app is the latest: 0.7.3. Yes, everything is on my desktop, and I've installed setuptools 0.9.8 Help!
Just incurred in the same problem but found the solution.
"For ease of distribution, you may wish to have your setup.py script automatically ensure that setuptools is installed. This requires having a copy of ez_setup in your project, which can be obtained from here:"
http://peak.telecommunity.com/dist/ez_setup.py
(Save it in your project directory with .py extension)
"Once this is done, you simply add the two line ez_setup preamble to the very beginning of your setup.py:"
import ez_setup
ez_setup.use_setuptools()
Source: https://pythonhosted.org/py2app/examples.html
You need to install setuptools.
Download it from here and then check this out to learn how to install it:
Python Setuptools, easy_install setup mac
Related
I was wondering if kivy supports Python 3 on Mac OS X systems. From the download page from the kivy official website, it seems that kivy-1.9.0 is available for Python 3.4 for Windows systems, but it does not seem to support Python 3 on Mac OS X:
Mac OS X Mac OS X 10.9, 10.10 (requires Python 2.7)
Kivy-1.9.0-rev3-osx.dmg (Mirror)
This seems a little but nonsensical, why kivy should support Python 3 on Windows but not on a Mac OS X? It could be because of the missing support of PyGame for Python 3 for OS X systems? Actually, there's a way to install PyGame for OS X systems for Python 3, so I do not understand why they do not fix this problem, if this is really a problem.
I have also tried to install it globally via pip3 using:
sudo pip3 install kivy
But I am getting the following error:
Collecting kivy Downloading Kivy-1.9.0.tar.gz (16.2MB)
100% |████████████████████████████████| 16.2MB 34kB/s
Complete output from command python setup.py egg_info:
Cython is missing, its required for compiling kivy !
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/tmp/pip-build-qt70t_44/kivy/setup.py", line 173, in <module>
from Cython.Distutils import build_ext
ImportError: No module named 'Cython'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-qt70t_44/kivy
You will need to build from source.
As a previous poster mentioned, you will need to get Cython installed.
To get the latest version, use
$ pip3 install cython
From there, you need to modify setup.py. Here's an example of how I did it.
According to the error message, you are missing the package cython:
Cython is missing, its required for compiling kivy !
...
ImportError: No module named 'Cython'
You should run pip install cython.
Then installing from source worked for me, by opposition to using pip.
I have a program that imports a library called pyfits. When I compile the project, I get an error that says:
Traceback (most recent call last):
File "C:\Users\KenPreiser\Desktop\Space thing\Sample.py",
line 2, in
import pyfits
ImportError: No module named 'pyfits'
I have pyfits downloaded to my E:\ drive. Is this a problem?
Downloading a library to any folder on your system will not make it available for the python interpreter to import into other modules.
pyfits has instructions on how to install it. Preferred way to install any python package is using pip.
If you have downloaded the .exe of the library, install it like how you would install any windows program.
If you have downloaded the source instead, uncompress the source archive. And install it with commands:
python setup.py build
python setup.py install
This will install the library into python site-packages. If pyfits is installed correctly executing this command:
python -c 'import pyfits; print pyfits.__version__'
from your command prompt should display the version information of the library. Once you confirm that you have installed it correctly by doing the above, you can re run your sample.py
The title basically explains it all.
I am running Windows 8 (windows 7 was previously installed... If it helps with answering) and am using Python 2.7.
Upon using the code:
python setup.py install
I am getting this error:
C:\Users\Nicholas\Desktop\taggit>python setup.py install
Traceback (most recent call last):
File "setup.py", line 52, in
from setuptools import setup
ImportError: No module named setuptools
Any help?
Thanks in advance
Nicholas
You need to install setuptools, which allows packages to be configured for your Python installation. It is not included with the default Python installer.
From this link you can download Windows installers for many Python packages (I have linked it directly to setuptools). Make sure you download the version that matches your Python installation.
in Python 3:
pip3 install setuptools
And in Python 2.x:
pip install setuptools
If I create a setup.py using requires, Pip doesn't install my dependencies.
Here's my setup.py:
from distutils.core import setup
setup(name='my_project',
description="Just a test project",
version="1.0",
py_modules=['sample'],
requires=['requests'])
I wrote a simple sample.py:
import requests
def get_example():
return requests.get("http://www.example.com")
I then try to install it:
$ pip install -e . [15:39:10]
Obtaining file:///tmp/example_pip
Running setup.py egg_info for package from file:///tmp/example_pip
Installing collected packages: my-project
Running setup.py develop for my-project
Creating /tmp/example_pip/my_venv/lib/python2.7/site-packages/my-project.egg-link (link to .)
Adding my-project 1.0 to easy-install.pth file
Installed /tmp/example_pip
Note that requests, my dependency isn't installed. If I now try to use my test project:
$ python [15:35:40]
>>> import sample
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/example_pip/sample.py", line 1, in <module>
import requests
ImportError: No module named requests
What am I doing wrong?
The correct spelling is install_requires, not requires; this does require that you use setuptools, not distutils:
from setuptools import setup
setup(name='my_project',
description="Just a test project",
version="1.0",
py_modules=['sample'],
install_requires=['requests'])
I can recommend the Python Packaging User Guide for the nitty gritty details.
I am trying to install a python module with the standard python setup.py install but I get the following error. I am fairly new to python but I have been able to install other modules in this way in the past. I am under the impression this module setuptools is not something I am supposed to have gotten separate from my python installation. Do I need to be in a specific directory or something?
Error:
Traceback (most recent call last):
File "setup.py", line 3 in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools
Apparently, that package requires you to have setuptools to install it. Setuptools is a module that provides easy installation of Python packages. You can get it on pypi, here.
Surprisingly, setuptools does NOT come pre-packaged with Python, despite how often and casually everyone refers to it. I also had this problem when learning Python.
Setuptools is available on the Python Package Index.