sharppy / SHARPpy

Sounding/Hodograph Analysis and Research Program in Python
https://sharppy.github.io/SHARPpy/index.html
Other
221 stars 110 forks source link

Unable to launch SHARPpy gui #86

Closed wxguy closed 8 years ago

wxguy commented 8 years ago

I am currently running upto date version of Arch Linux and installed the latest version of SHARPpy. The installation procedure I followed is from the official documentation http://sharppy.github.io/SHARPpy/documentation.html. Installation was success as you can see from below:-

$python2.7
Python 2.7.11 (default, Dec  6 2015, 15:43:46) 
[GCC 5.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sharppy
>>> 

Then I moved to the runsharp directory on the source directory and try to run the full_gui.py script. But it resulted in the following error:-

runsharp]$ python2.7 full_gui.py 
Traceback (most recent call last):
  File "full_gui.py", line 30, in <module>
    from datasources import data_source
  File "/usr/lib/python2.7/site-packages/SHARPpy-1.3.0-py2.7.egg/datasources/data_source.py", line 19, in <module>
    available = imp.load_source('available', avail_loc)
IOError: [Errno 2] No such file or directory

Is it expecting some data file eve before launching GUI?

keltonhalbert commented 8 years ago

Hmmm.... I'm not exactly sure what might be going on here. I just wiped my installation and reinstalled the current version and didn't have any issues.

Does ~/.sharppy exist?

aarande commented 8 years ago

I am seeing this same behavior except on Windows. I created an Anaconda environment named sharppy that I installed everything into...then when I go to run full_gui.py with that environment activated I get the following: [sharppy] L:\SHARPpy\runsharp>python full_gui.py Traceback (most recent call last): File "full_gui.py", line 30, in from datasources import data_source File "C:\Anaconda\envs\sharppy\lib\site-packages\sharppy-1.3.0-py2.7.egg\datas ources\data_source.py", line 19, in available = imp.load_source('available', avail_loc) IOError: [Errno 2] No such file or directory

The interesting part is it is looking in C:\Anaconda\envs\sharppy\lib\site-packages where lib is lowercase...however in Anaconda it is Lib...hence why it can't find it. Not sure why it is doing this as the import should just know and be able to handle this.

aarande commented 8 years ago

I'm starting to think this has more to do with SHARPpy trying to write into the users HOME directory than anything else the more I look at the guts of the code. Our permissions are a little more locked down here so it may be causing this. It more looks like it is failing at this point available = imp.load_source('available', avail_loc) in data_source.py.

Kelton or others can you give a little more background on what SHARPpy does in the users HOME directory and what it needs. Is there any kind of check if it is on windows and using the APPDATA area instead?

aarande commented 8 years ago

Ok it looks like it is looking for .sharppy folder in the users HOME directory and not finding it. I installed SHARPpy as Administrator and when I looked in the Administrator users that folder exists and has everything I would expect. However no other user has that folder in their HOME directory and if they try to run SHARPpy it fails.

How do you install SHARPpy to allow for any user on the system to be able to run it? Right now it appears it will only work for the user who installed the package, unless you possible copy that .sharppy folder to each user which I would not want to do and would be cumbersome.

keltonhalbert commented 8 years ago

Hi Aaron,

It's definitely looking in the home directory. It was done this way as a means of allowing the user to make modifications to configure files, data sources, decoders, etc, without rerunning setup. It's very similar to the .matplotlib directory where users configure default plotting attributes. If it can't write to the home directory and copy over the files, the full_gui will not work properly.

When you install matplotlib on Windows, it still creates the .matplotlib directory in the user's home. Perhaps we'RE doing something wrong where it gets rejected when running on restricted permissions?

Right now, its hardcoded to ~/.sharppy - I'm not familiar with APPDATA on windows... do you have more details on how that's set up?

Sent from my HTC

----- Reply message ----- From: "Aaron Anderson" notifications@github.com To: "sharppy/SHARPpy" SHARPpy@noreply.github.com Cc: "Halbert, Kelton T." keltonhalbert@ou.edu Subject: [SHARPpy] Unable to launch SHARPpy gui (#86) Date: Fri, Jan 15, 2016 12:10 PM

I'm starting to think this has more to do with SHARPpy trying to write into the users HOME directory than anything else the more I look at the guts of the code. Our permissions are a little more locked down here so it may be causing this. It more looks like it is failing at this point available = imp.load_source('available', avail_loc) in data_source.py.

Kelton or others can you give a little more background on what SHARPpy does in the users HOME directory and what it needs. Is there any kind of check if it is on windows and using the APPDATA area instead?

Reply to this email directly or view it on GitHubhttps://github.com/sharppy/SHARPpy/issues/86#issuecomment-172039933.

keltonhalbert commented 8 years ago

Yes, that's the problem.

Unfortunately, I'm personally not too sure on how to solve this. Theoretically though, you shouldn't need administrator rights to install anaconda or SHARPpy, so we never considered the problem before.

There might be s better way to do this, but I'm not quite certain of how off the top of my head.

Sent from my HTC

----- Reply message ----- From: "Aaron Anderson" notifications@github.com To: "sharppy/SHARPpy" SHARPpy@noreply.github.com Cc: "Halbert, Kelton T." keltonhalbert@ou.edu Subject: [SHARPpy] Unable to launch SHARPpy gui (#86) Date: Fri, Jan 15, 2016 12:20 PM

Ok it looks like it is looking for .sharppy folder in the users HOME directory and not finding it. I installed SHARPpy as Administrator and when I looked in the Administrator users that folder exists and has everything I would expect. However no other user has that folder in their HOME directory and if they try to run SHARPpy it fails.

How do you install SHARPpy to allow for any user on the system to be able to run it? Right now it appears it will only work for the user who installed the package, unless you possible copy that .sharppy folder to each user which I would not want to do and would be cumbersome.

Reply to this email directly or view it on GitHubhttps://github.com/sharppy/SHARPpy/issues/86#issuecomment-172042071.

aarande commented 8 years ago

Yeah I think I see the issue now and I think it will be a big one especially as more organizations start to use it that have multiple users. You would never know it just running it on your own computer.

The one thing I can think of is maybe having some kind of default/override capability where the default resides in the package. Like with matplotlib it has defaults built into it but if you want to override them you can create that file and make some overrides as it looks for the matplotlibrc file in four different places with the last one being inside the package (http://matplotlib.org/users/customizing.html#the-matplotlibrc-file). However, matplotlib will still work for any user on the computer. The one thing I can think of off the top of my head real quick is to have it look for the files first in the users HOME directory and use them if it finds them and if not use the default files in the package.

aarande commented 8 years ago

Or another option is to have a check where it copy a set of defaults to the users HOME directory if they do not exist when you start full_gui.py. However, I think the first option is more robust and will be better in the long run.

aarande commented 8 years ago

Here is a good Python module for handling this cross-platform...https://pypi.python.org/pypi/appdirs/1.4.0 this could make it pretty easy to implement.

I would say at the very least we would want a site level directory with a user being a big bonus. If I make changes or add sites I would likely want them available to everyone and I am not going to want to copy the file around to 20 different user folders.

I think ultimately have it looking in user then site then default in the package would be ideal.

nguy commented 8 years ago

I just updated my code base yesterday and am having trouble launching the GUI. Below is the message:

guy:runsharp $ python full_gui.py

Well, this is embarrassing.
SHARPpy broke. This is probably due to an issue with one of the data source servers, but if it keeps happening, send the detailed information to the developers.

Detailed Information:
SHARPpy v1.3.0 Xenia
Crash time: 2016-04-01 09:40:57.033825
Traceback (most recent call last):
  File "full_gui.py", line 54, in doCrasher
    ret = func(*args, **kwargs)
  File "full_gui.py", line 666, in createWindow
    return Main()
  File "full_gui.py", line 545, in __init__
    self.__initUI()
  File "full_gui.py", line 551, in __initUI
    self.picker = Picker(self.config, parent=self)
  File "full_gui.py", line 96, in __init__
    self.data_sources = data_source.loadDataSources()
  File "/Users/guy/anaconda/lib/python2.7/site-packages/SHARPpy-1.3.0-py2.7.egg/datasources/data_source.py", line 42, in loadDataSources
    ds[name] = DataSource(src)
  File "/Users/guy/anaconda/lib/python2.7/site-packages/SHARPpy-1.3.0-py2.7.egg/datasources/data_source.py", line 244, in __init__
    self._observed = config.get('observed').lower() == "true"
AttributeError: 'NoneType' object has no attribute 'lower'
tsupinie commented 8 years ago

I think that's the SPC site having issues. SHARPpy has to make two requests to the SPC site, and it does that when the SPC site lets the first connection through, but not the second. I'm getting a workaround for that (because that's getting annoying for me, too), and eventually we might drop SPC as a data source altogether.

nguy commented 8 years ago

Thanks @tsupinie . I'll try to keep an eye out for updated code.

tsupinie commented 8 years ago

I'll go ahead and close this, since I accepted your PR.