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

🐛 some errors in binder deployment. #34

Closed
2 tasks done
ChristinaLast opened this issue Mar 17, 2022 · 6 comments
Closed
2 tasks done

🐛 some errors in binder deployment. #34

ChristinaLast opened this issue Mar 17, 2022 · 6 comments
Assignees

Comments

@ChristinaLast
Copy link
Collaborator

ChristinaLast commented Mar 17, 2022

Tasks

  • Fix 'great_circle' is not defined
  • Fix simplekml needs to be installed to create KML outputs!

Associated tracebacks

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/tmp/ipykernel_60/1620428857.py in <module>
      3 
      4 xmin, xmax, ymin, ymax, myimg_shape, size_in_m = \
----> 5         mymaps.calc_pixel_width_height(all_maps[0])

/srv/conda/envs/notebook/lib/python3.7/site-packages/mapreader/loader/images.py in calc_pixel_width_height(self, parent_id, calc_size_in_m)
    349 
    350         elif calc_size_in_m in ['gc', 'great-circle']:
--> 351             bottom = great_circle((ymin, xmin), (ymin, xmax)).meters
    352             right = great_circle((ymin, xmax), (ymax, xmax)).meters
    353             top = great_circle((ymax, xmax), (ymax, xmin)).meters

NameError: name 'great_circle' is not defined
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
/srv/conda/envs/notebook/lib/python3.7/site-packages/mapreader/loader/images.py in _createKML(self, path2kml, value, coords, counter)
    817         try:
--> 818             import simplekml
    819         except:

ModuleNotFoundError: No module named 'simplekml'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
/tmp/ipykernel_60/28836796.py in <module>
      4             save_kml_dir="./kml_tutorial",
      5             figsize=(20, 20),
----> 6             image_width_resolution=600)

/srv/conda/envs/notebook/lib/python3.7/site-packages/mapreader/loader/images.py in show(self, image_ids, value, plot_parent, border, border_color, vmin, vmax, colorbar, alpha, discrete_colorbar, tree_level, grid_plot, plot_histogram, save_kml_dir, image_width_resolution, kml_dpi_image, **kwds)
    675                                     value=one_image_id,
    676                                     coords=self.images["parent"][one_image_id]["coord"],
--> 677                                     counter=-1)
    678                 else:
    679                     plt.title(one_image_id)

/srv/conda/envs/notebook/lib/python3.7/site-packages/mapreader/loader/images.py in _createKML(self, path2kml, value, coords, counter)
    818             import simplekml
    819         except:
--> 820             raise ImportError("[ERROR] simplekml needs to be installed to create KML outputs!")
    821 
    822         (lon_min, lon_max, lat_min, lat_max) = coords

ImportError: [ERROR] simplekml needs to be installed to create KML outputs!
@ChristinaLast ChristinaLast self-assigned this Mar 17, 2022
@kasra-hosseini
Copy link
Member

@ChristinaLast Could you please try installing MapReader via:

pip install 'git+https://github.com/Living-with-machines/MapReader.git#egg=MapReader[maps]'

See: https://github.com/Living-with-machines/MapReader#method-1

When you add [maps] in ...MapReader.git#egg=MapReader[maps] (maybe we should change it to [all]?), the following libraries will be installed as well:

EXTRAS_REQUIRE = {
        'maps': [
            "geopy==2.1.0",
            "rasterio>=1.2.10,<2.0.0",
            "keplergl>=0.3.2,<0.4.0",
            "simplekml>=1.3.6,<2.0.0"
            ]
        }

(See https://github.com/Living-with-machines/MapReader/blob/main/setup.py)

@ChristinaLast
Copy link
Collaborator Author

ChristinaLast commented Mar 17, 2022

Thanks, I will check this potential fix out. Note: these errors are occuring in the binder build, and im not sure how this pip install is reflected in the build. Any ideas?

@kasra-hosseini
Copy link
Member

kasra-hosseini commented Mar 17, 2022

Sorry, I should have opened an issue and have explained the decision there, but to clarify, we now can install MapReader in two ways:

  • pip install 'git+https://github.com/Living-with-machines/MapReader.git'
  • pip install 'git+https://github.com/Living-with-machines/MapReader.git#egg=MapReader[maps]'

The former installs what is needed for non-map inputs (excluding EXTRAS_REQUIRE), simplifying the whole installation process, particularly on Windows. In the latter, we install EXTRAS_REQUIRE as well; this includes gdal, rasterio, ... which are needed when working with maps.

@kasra-hosseini
Copy link
Member

Thanks, I will check this potential fix out. Note: these errors are occuring in the binder build, and im not sure how this pip install is reflected in the build. Any ideas?

@ChristinaLast
Copy link
Collaborator Author

Ok, maaybe I am misunderstanding, but, requirements.txt file is not present in the directory, how are we building packages for binder repo? and how do we include the EXTRAS_REQUIRE in the build?

@ChristinaLast
Copy link
Collaborator Author

Ok, even running pip freeze > requirements.txt with simpleKML is returns the error.

@kasra-hosseini kasra-hosseini added this to Backlog in Project board via automation Mar 23, 2022
@kasra-hosseini kasra-hosseini moved this from Backlog to In progress in Project board Mar 23, 2022
Project board automation moved this from In progress to Done Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants