David, Todd, et al.

There are some problems with canopy and makeMacApp.py. When the python app 
included in canopy is invoked directly, it does not get the path right to all 
packages. It can be fixed with changes to pythonhome and pythonpath, but not 
that easily. I have had some conversations with Enthought on this, but they 
don't have a solution to our "use case." For now,

python <path>GSASII.py

is the solution with canopy.

Brian

On Mar 17, 2014, at 8:21 AM, David Elbert wrote:

Todd,

Hello from all the way across campus!  :)

The problem is that GSAS II is looking at the wrong version of Python or 
perhaps in the wrong place for some parts of Python.  A critical thing for GSAS 
II is using 32-bit Python because some of the required modules aren’t available 
in 64-bit.  The error message is a bit of a red herring in that it makes you 
think you should install the missing module, but it is really a 32-bit versus 
64-bit problem because something else that is found in the GSAS-II install is 
32-bit and is looking for a 32-bit version of a module that the system’s Python 
can’t provide.

Here is a bit of a rambling note on how you might get GSAS II working. (Sorry, 
I don’t have time to edit it down and I may be telling you stuff you already 
know, but maybe it will sit here and help newbies).  It’s tricky to get the 
paths and things right on a Mac and Apple didn’t do us any favors by changing 
things up in different versions of the operating system. Python uses virtual 
environments to allow one to have different configurations for different 
applications, but it can be very hard to know just how to get into the right 
virtual environment with a generic app like the one GSAS II creates.  I don’t 
have Mavericks, but run it in Snow Leopard and find the following works:

1. Install 32-bit Enthought Canopy Python.  Where I differ from the online 
install instructions is that I skipped the Canopy Gui and did this:
a. downloaded 32-bit canopy and put it in the Applications folder
b. installed a simple, command line version of Canopy Python from the terminal 
using:

/Applications/Canopy.app/Contents/MacOS/Canopy_cli setup /Users/username/canopy 
 --default

c. edited my .bash_profile file to make sure it has the following two lines 
uncommented:

export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}
VIRTUAL_ENV_DISABLE_PROMPT=1 source /Users/username/canopy/bin/activate

Note: The first line establishes the path for the normal, system Python in Snow 
Leopard; I don’t know if that is right for Mavericks. The second line means 
that when anything (you or an app) opens a Bash shell, the Canopy virtual 
environment will be activated.  Test that like this:

1. Open a Terminal shell
2. Type ‘which python’ and see that the result is a path to 
/Users/username/canopy/bin/python
3. Check that you have the 32-bit running by typing:
‘Python’
import sys
sys.maxsize

The result should be something like 2147483647.  If the result is 
9223372036854775807 you are running 64-bit Python and have to back up and 
figure out if you installed the wrong version in ~/canopy.

Note: If you need to run the regular, system Python you can always go into a 
Terminal shell and type ‘deactivate’.  Or go into your .bash_profile and 
comment out the virtual environment line. You may want to do this when you are 
not routinely running GSAS II.

Assuming that is all working, you can now install and run GSAS II.  Make a 
directory for it, download the bootstrap.py file and put it in that directory. 
Open a Terminal shell and type ‘python bootstrap.py’.  It is best to do this 
after you have already gotten your Python installation set and working in 
Canopy 32-bit.  If you did it from the wrong Python you may have trouble later 
like missing things that aren’t available in the 64-bit version. In your case, 
make a new directory and run the bootstrap script anew once you have 32-bit 
Python working.

Now you have a choice. One of the last (maybe the last) step in the bootstrap 
installation is the creation of an AppleScript app called GSAS-II that you 
double click to launch GSAS II.  This is created by a Python script called 
makeMacApp.py and if you look at it in an editor you will see that it counts on 
using an environment variable called pythonhome to know where to look for the 
Python to boot.  In my experience, that doesn’t work because pythonhome isn’t 
set in most people’s systems and it is hard to get pythonhome to point to the 
right thing; I suspect there is something about pythonhome and pythonpath on 
Macs that I don’t understand.  When you double click the GSAS-II application 
created by makeMacApp.py what you do is start the system Python instead of that 
32-bit Canopy version with all the right modules loaded and you get the error 
message that brought you to this forum.  Your choice is to fix the makeMacApp 
script to suit your personal installation and version of Mac OS, or do what I 
do.  What I do is simply open a Terminal shell and type:

cd GSASII
python GSASII.py

GSAS II opens its windows and off you go.

Hope that helps-
David


David Elbert
Associate Program Director for Environmental Studies,
Advanced Academic Programs &
Earth and Planetary Sciences
Olin Hall
Johns Hopkins University




_______________________________________________
GSAS-II mailing list
GSAS-II@mailman.aps.anl.gov<mailto:GSAS-II@mailman.aps.anl.gov>
https://mailman.aps.anl.gov/mailman/listinfo/gsas-ii

********************************************************************
Brian H. Toby, Ph.D.                            office: 630-252-5488
Senior Physicist/Section Head for Scientific Software
Advanced Photon Source
9700 S. Cass Ave, Bldg. 401/B4192            work cell: 630-327-8426
Argonne National Laboratory
Argonne, IL 60439-4856         e-mail: brian dot toby at anl dot gov
********************************************************************
"We will restore science to its rightful place, and wield technology's 
wonders... We will harness the sun and the winds and the soil to fuel our cars 
and run our factories...  All this we can do. All this we will do."

_______________________________________________
GSAS-II mailing list
GSAS-II@mailman.aps.anl.gov
https://mailman.aps.anl.gov/mailman/listinfo/gsas-ii

Reply via email to