Opened 8 years ago

Last modified 8 years ago

#51695 new defect

could not use setup.py to install pyraf using the macports installation of python 2.7

Reported by: SmritiM84 Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc:
Port:

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I have installed python 2.7 using macports and it seemed to work fine untill I had to install Pyraf. Amongst others the last bit of the installation code read:

   warning: manifest_maker: standard file '-c' not found
    
    
    The C compiler used to compile Python gcc-4.2, and
    which is normally used to compile C extensions, is not
    available. You can explicitly specify which compiler to
    use by setting the CC environment variable, for example:
    
        CC=gcc python setup.py <command>
    
    or if you are using MacOS X, you can try:
    
        CC=clang python setup.py <command>
    
    
    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/zt/rfcx53ks5b7_1_773_2jwpp80000gn/T/pip-build-ImCNyh/astropy

Now I do have gcc installed, so I tried looking for setup.py and I think the one installed with Macports version of Python on my laptop is in /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/python/py-entrypoints/files/

but when I try running python /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/python/py-entrypoints/files/setup.py install

I get

running install
running build
running build_py
creating build
error: could not create 'build': Permission denied

Not sure how to use setup.py to install Pyraf or for that matter other modules. I am using Python 2.7 on Mac OS X 10.9.5

Change History (4)

comment:1 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

The message stating that Python was compiled with gcc-4.2 is strange. That would not be the case on OS X 10.9.5. OS X 10.6.8 was the last OS X version to feature gcc-4.2. Are you sure you are running MacPorts python? What version of Xcode do you have installed?

Don't try to directly run files inside the MacPorts ports tree; they're not for you; they're for MacPorts to use when installing ports. Each Python module or project will typically include its own setup.py file tailored to that project's needs; that's the setup.py you'll be using to build that project.

Don't forget to use WikiFormatting when writing in Trac.

comment:2 Changed 8 years ago by SmritiM84

I have Xcode version 5.1.1 installed.

Also which gcc returns /usr/bin/gcc.

I am sure I am using the Macports python, because I have explicitly set the path to it in the .profile file using alias python='/opt/local/bin/python2.7'. I have to admit though that I do have other installations of Python 2.7 on my laptop, which perhaps came in bundled with other packages I installed earlier, but I do not know how to get rid of them to clean up the system.

I tried using CC=clang python setup.py pip install pyraf

but that returns

/opt/local/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

Not sure though why it is searching for setup.py in the /Frameworks/.. directory tree, when I have specified which Python I want to use.

Last edited 8 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:3 in reply to:  2 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to mahajan.smriti@…:

I have Xcode version 5.1.1 installed.

Ok, good, that's a supported version for OS X 10.9. You could update to as new a version as 6.2 if you wanted to.

Also which gcc returns /usr/bin/gcc.

That is normal. You should find that if you run gcc --version, it informs you that it is not in fact gcc but actually clang.

I am sure I am using the Macports python, because I have explicitly set the path to it in the .profile file using alias python='/opt/local/bin/python2.7'. I have to admit though that I do have other installations of Python 2.7 on my laptop, which perhaps came in bundled with other packages I installed earlier, but I do not know how to get rid of them to clean up the system.

Ok. Instead of setting an alias in your .profile, you could instead use sudo port select python python27.

I tried using CC=clang python setup.py pip install pyraf

but that returns

/opt/local/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

This means there is no file called setup.py in the current directory.

Not sure though why it is searching for setup.py in the /Frameworks/.. directory tree, when I have specified which Python I want to use.

It's not searching for setup.py in the /Frameworks/.. directory tree. Rather, /opt/local/bin/python2.7 is a symlink to /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python. So python is merely printing its full path for you.

It looks like you're getting confused about how to install python modules. You can either download the source code and run the setup.py file contained therein, or you can use pip to install it for you; you don't do both. Check the pyraf installation instructions.

comment:4 Changed 8 years ago by SmritiM84

OK, Point taken regarding getting confused between both the methods. But the question is:

  1. How do I resolve the gcc error which I am getting when using 'pip install pyraf'. OR
  1. In the meantime I have also tried to download the source code, and tried installing by the second method using setup.py, but now I get the following error when using 'python setup.py install' (as per the instructions on the Pyraf installation page.

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
site-packages/setuptools/dist.py:285: UserWarning: Normalizing '0.2.13.dev' to '0.2.13.dev0'
normalized_version,

running install

error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the installation directory:

[Errno 13] Permission denied: '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/
lib/python2.7/site-packages/test-easy-install-690.write-test'

The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/

Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable.

For information on other options, you may wish to consult the documentation at:

https://pythonhosted.org/setuptools/easy_install.html

Please make the appropriate changes for your system and try again.

So it still seems to me like there is an issue with the Macports installed Python!?

Note: See TracTickets for help on using tickets.