ChHarding / TouchTerrain_jupyter_docker

Image for running Touchterrain standalone via a jupyter notebook
15 stars 4 forks source link

Importing python packages - TouchTerrain_jupyter_for_starters #1

Open Rolleroo opened 3 years ago

Rolleroo commented 3 years ago

Loving this idea of this and really would like to put it to use.

I am having issues importing the packages in thee starter notebook. I don't get the message.

EE init() worked with .config/earthengine/credentials!

After this I get the following message which appears to be an issue with authentication of ee

AttributeError: module 'ee' has no attribute 'Reducer'

I am unsure if the errors coming up when touch terrain is first started in Docker are at fault? Terrain Touch Beginner Notebook Errors.txt

Any help much appreciated.

ChHarding commented 3 years ago

This is an issue with the earth-engine-api package, which is turn doesn’t work with the current (2.x) version of google-api-python-client. The workaround for now seems to be to use the “old” google-api-python-client version 1.12.8. But, I’m confused why you would get this b/c I’ve been forcing this downgrade in setup.py for a while now:

install_requires=[ 'Pillow>=6.0.0', 'google-api-python-client==1.12.8', # Mar 11, 2021: use pre 2.0 version until that's fixed 'earthengine-api>=0.1.232', # 1.232 is required after Aug 19, 2020 'Flask>=1.0.2',

'vectors==99.0.0', # is now part of common folder

'oauth2client>=4.1.3', 'numpy>=1.17', 'kml2geojson>=4.0.2', # for reading polygon coords from kml 'geojson>=2.5', # for wrapping polygon data 'defusedxml>=0.6', # safe minidom for parsing kml 'six>=1.15.0', # earthengine apparently uses an old version of six ... ],

So, I’m guessing you’re running the starter notebook but not within the docker container (https://github.com/ChHarding/TouchTerrain_jupyter_docker https://github.com/ChHarding/TouchTerrain_jupyter_docker)? If so, you could just the installer manually:

1) open a terminal shell (cmd.exe or powershell) 2) cd (which contains a rouchterrain folder and the setup.py script, and other stuff …) 3) run this: pip install . (<- dot!)

This should install the proper versions. Not sure if it will uninstall any newer version of google-api-python-client, maybe do a pip uninstall google-api-python-client first?

The other option is to do the install at the beginning of the notebook. For the starter notebook, I didn’t put that in b/c I assumed that the installation was done via the docker container but the notebook is opened. But, in the TouchTerrain_standalone_jupyter_notebook.ipynb there’s a cell that does the same as pip install . , in a terminal:

import sys !{sys.executable} -m pip install .

Once you’ve run this cell your can comment it out (or just skip it from now on).

Or does this happen with the docker container?

Cheers

Chris

On May 6, 2021, at 11:09, Kenny McKee @.***> wrote:

Loving this idea of this and really would like to put it to use.

I am having issues importing the packages in thee starter notebook. I don't get the message.

EE init() worked with .config/earthengine/credentials!

After this I get the following message which appears to be an issue with authentication of ee

AttributeError: module 'ee' has no attribute 'Reducer'

Any help much appreciated.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ChHarding/TouchTerrain_jupyter_docker/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYDF5P6V2DC5C5JA2R23XLTMK5KDANCNFSM44HLSVIQ.

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences

TouchTerrain.geol.iastate.edu

Rolleroo commented 3 years ago

Hi there,

Retried and got it working as advertised.

I think I was running from inside Docker as you mentioned.

Also had to sign up for GE on my Google account which it noted may take a few days to update.

Particularly happy with the polygon selection.

Really appreciate the work you've put into this. Keep up the good work. Is there anywhere I can support you or post on?

Rolleroo

ChHarding commented 3 years ago

That’s great to hear! Glad to see that more and more users are using the Docker version (which was new to me and took some effort to set up).

Can I ask what you’re using TouchTerrain for?

Re helping: I’m a social media luddite myself, so posting something on any kind of social media you happen to frequent would be appreciated, especially to spread the word about the Docker version. Maybe a good synopsis is the ESRI Story map I recently created: https://arcg.is/11Cv5D https://arcg.is/11Cv5D

On May 10, 2021, at 14:24, Kenny McKee @.***> wrote:

Hi there,

Retried and got it working as advertised.

I think I was running from inside Docker as you mentioned.

Also had to sign up for GE on my Google account which it noted may take a few days to update.

Particularly happy with the polygon selection.

Really appreciate the work you've put into this. Keep up the good work. Is there anywhere I can support you or post on?

Rolleroo

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChHarding/TouchTerrain_jupyter_docker/issues/1#issuecomment-837191284, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYDF5JD2GDFA26YSQQI2BDTNAXFJANCNFSM44HLSVIQ.

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences

TouchTerrain.geol.iastate.edu

Rolleroo commented 3 years ago

I use it for printing terrain maps, generally as gifts but some for interest. My son has asked for a map of the world in the game Skyrim which I'll have to master geotiffs for.

Unfortunately social media doesn't come easily to me either but I'll see what I can do!

ChHarding commented 3 years ago

On May 10, 2021, at 14:56, Kenny McKee @.***> wrote:

I use it for printing terrain maps, generally as gifts but some for interest. My son has asked for a map of the world in the game Skyrim which I'll have to master geotiffs for.

I’ve actually done this a while ago for my nephew. I used this https://staticdelivery.nexusmods.com/mods/110/images/52675-3-1396623946.jpg https://staticdelivery.nexusmods.com/mods/110/images/52675-3-1396623946.jpg, heavily massaged it in GIS and then run it through TouchTerrain. The resolution is not great but it worked out OK for a 240 mm wide 3D print. As I can’t find any actual elevations for their mountains I had to guess the z-scale and 0.2 looks about right (but could be anything between 0.1 and 0.3).

Here’s my (GIS massaged) tif and the notebook with the settings. Put the tif into the stuff folder and run it (Skip all the print area definition cells, obviously …) You can remove the offshore (elevation = 0) cells to get one big island, however, there are some 0 cell inland as well and those might look weird as holes in your print.

Unfortunately social media doesn't come easily to me either but I'll see what I can do!

Don’t worry about it then …

Cheers

Chris

gravity981 commented 2 years ago

AttributeError: module 'ee' has no attribute 'Reducer'

I had this problem too. Running ee.Initialize() after importing ee (and after first time authentication) solved the problem for me.

ChHarding commented 2 years ago

I’ve not run the docker version in while. Another contributor added code for the offset layers but didn’t run it in docker. I’ll look it tomorrow.

On Aug 15, 2021, at 11:20, gravity981 @.***> wrote:

AttributeError: module 'ee' has no attribute 'Reducer'

I have had this problem too. Running ee.Initialize() after importing it (and after first time authentication) solved the problem for me.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChHarding/TouchTerrain_jupyter_docker/issues/1#issuecomment-899075722, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYDF5JKS2ZQ73QWFDHULALT47SNVANCNFSM44HLSVIQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences

TouchTerrain.geol.iastate.edu

sr71shark commented 2 years ago

I also had this issue with the same notebook. It seems to have been fixed by both following the given by @ChHarding of:

1) open a terminal shell (cmd.exe or powershell) 2) cd (which contains a rouchterrain folder and the setup.py script, and other stuff …) 3) run this: pip install . (<- dot!)

But then I had to also run ee.Initialize() as @gravity981 said above.

But now I have another issue I'm struggling to figure out. I will create a new issue ticket for that one though.