Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmltodict module missing #31

Closed
mmartini-usgs opened this issue Oct 10, 2018 · 10 comments
Closed

xmltodict module missing #31

mmartini-usgs opened this issue Oct 10, 2018 · 10 comments

Comments

@mmartini-usgs
Copy link
Contributor

xmltodict is required when importing stglib.
(https://github.com/dnowacki-usgs/stglib/blob/master/requirements.txt)

If it isn't in one's environment one gets this error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-ae9bfbeb1548> in <module>()
     11 import sys
     12 sys.path.append("c:\\projects\\python\\stglib")
---> 13 import xmltodict
     14 import stglib
     15 get_ipython().run_line_magic('matplotlib', 'inline')

ModuleNotFoundError: No module named 'xmltodict'

It is not part of the IOOS package (http://ioos.github.io/notebooks_demos/other_resources/)

The work around:

activate IOOS
conda install xmltodict 

The permanent solution:
Get xmltodict on the list in ioos.github.io

@rsignell-usgs
Copy link
Member

rsignell-usgs commented Oct 10, 2018

I'm not sure this belongs in the IOOS env since this is the first time this has come up, so not a widely used package and not used in the IOOS demos. Since xmltodict is on conda-forge, it's easy to add just as you mention. So I would say conda install xmltodict is not a workaround. It's just a package that some folks might want to add to their IOOS environment (or some other environment).

@mmartini-usgs
Copy link
Contributor Author

OK, so needs to be in the installation instructions for stglib as all it says is:
“If you get errors about missing packages, install them using conda install.”

Or maybe that’s standard practice in python?

Seems to me listing the known non-IOOS packages to expect to install would be helpful since we are going down this path to encourage people to use IOOS and then stglib together.

@rsignell-usgs
Copy link
Member

How about we maintain our own environment.yml for stglib?

@rsignell-usgs
Copy link
Member

This should be easy because we have:
https://github.com/dnowacki-usgs/stglib/blob/master/requirements.txt

@mmartini-usgs
Copy link
Contributor Author

Yep, and xmltodict is the only thing not in IOOS on that list. xml is all over the place in raw instrument and other descriptive information. Seems to me that xmltodict would be a handy addition.

Personally, I'm trying to stay in one python sand box just to keep things simple, efficient and effective.

@rsignell-usgs
Copy link
Member

rsignell-usgs commented Oct 10, 2018

I still think it would be best to create your own environment.yml for your one python sand box. Simply take the IOOS env, remove the packages you don't use, and add the ones you do use. Then when you add new packages, add them to the environment.yml file. That way when your environment goes belly up (which is bound to happen when you use python) you can easily just create it again.

@mmartini-usgs
Copy link
Contributor Author

Sure I can do that.

And I stand by my point which I may not have been clear: to make this package easy to go viral because stglib is intended to be something to help unify data from three Centers.

As someone who has come to python from programming environments that are much more stable, we might find little things like this as headwinds to adoption of stglib more universally.

@dnowacki-usgs
Copy link
Member

Thanks for your feedback, Marinna. Much appreciated.

An environment.yml is one good way to deal with this, and I can add it to my list. I prefer to do as much package management as possible using conda, which is why I suggest that unfulfilled dependencies (like xmltodict) be taken care of using it. But even better to let people do conda env create -f environment.yml to have their own stglib environment.

@mmartini-usgs
Copy link
Contributor Author

Dan - at this point, if you agree with Rich, there's nothing for you to do. It's in the requirements list. People will get the error and then use conda to add it. I'm just pointing out ways to smooth the road for people who are not yet very environment savvy and are keen to use the new toys.

Time to close this thread.

@dnowacki-usgs
Copy link
Member

We now have an environment.yml for stglib, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants