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

geovista.pantry is not a package - VS Code #965

Open
felixdellner opened this issue Jul 3, 2024 · 9 comments
Open

geovista.pantry is not a package - VS Code #965

felixdellner opened this issue Jul 3, 2024 · 9 comments
Assignees
Labels
scipy 2024 type: bug Auto-labelled for bug/*, fix/* and patch/* branches

Comments

@felixdellner
Copy link

🐛 Bug Report

ModuleNotFoundError: No module named 'geovista.pantry.data'; 'geovista.pantry' is not a package

How to Reproduce

Trying to run the examples provided here gives the above error, specifically this line raises the error
from geovista.pantry.data import nemo_orca2_gradient

Expected Behaviour

A working example :)

Environment

Tried

scooby --report geovista

or

----------------------------------------------------------------------------------------

                 OS : Windows (10 10.0.22631 SP0 Multiprocessor Free)
             CPU(s) : 12
            Machine : AMD64
       Architecture : 64bit
                RAM : 15.9 GiB
        Environment : Python
         GPU Vendor : NVIDIA Corporation
       GPU Renderer : NVIDIA GeForce RTX 2060/PCIe/SSE2
        GPU Version : 4.5.0 NVIDIA 537.70

  Python 3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit
  (AMD64)]

            cartopy : 0.23.0
              click : 8.1.3
click-default-group : 1.2.4
            cmocean : 4.0.3
           colorcet : Module not found
           geovista : 0.5.0.dev464
         matplotlib : 3.5.2
            netcdf4 : 1.7.1.post1
              numpy : 1.26.4
       platformdirs : 4.1.0
              pooch : 1.8.2
           pykdtree : 1.3.12
             pyproj : 3.6.1
            pyvista : 0.43.10
             scooby : 0.10.0
                vtk : 9.3.1
            IPython : 8.20.0
        fastparquet : 2024.5.0
         ipywidgets : 8.1.3
         jupyterlab : 4.0.10
       nest_asyncio : 1.5.8
             pandas : 2.1.4
              scipy : 1.8.1
              trame : 3.6.3
       trame_client : 3.2.1
       trame_server : 3.0.2
          trame_vtk : 2.8.9
      trame_vuetify : 2.6.0
               tqdm : 4.64.0
             wslink : 2.1.1
----------------------------------------------------------------------------------------

Additional Context

This only happens in Visual Studio Code - in a separate Jupyter Notebook it runs as expected (where I however can not get VTK to run, but I think this might be my own fault, otherwise I'll submit another issue!)

@felixdellner felixdellner added new: issue Highlight a new community raised "generic" issue type: bug Auto-labelled for bug/*, fix/* and patch/* branches labels Jul 3, 2024
Copy link

welcome bot commented Jul 3, 2024

📢 Nice one! Your first issue! Thanks for telling us how to improve geovista 📢

@bjlittle bjlittle removed the new: issue Highlight a new community raised "generic" issue label Jul 3, 2024
@bjlittle bjlittle self-assigned this Jul 3, 2024
@bjlittle
Copy link
Owner

bjlittle commented Jul 4, 2024

Hey @felixdellner!

Great to hear from you, and thanks for raising this issue 👍

Thanks also for including the scooby report, which is really helpful.

I'm guessing that you're using a development installation of geovista given the version is 0.5.0.dev464 and you also mentioned that the example is working outside vscode.

I suspect this might be an issue with the lazy-loader package (and vscode), which we use within geovista to support lazy imports.

Would it be possible for you to set the EAGER_IMPORT environment variable to disable lazy imports to see if this is indeed the root of the problem with vscode, and let me know the outcome?

For reference see here and here.

Also, a quick fix alternative for the example in question might be to explicitly import geovista.pantry as follows:

import geovista as gv
import geovista.pantry                                 # <------ force the import
from geovista.pantry.data import nemo_orca2_gradient
from geovista.pantry.meshes import ZLEVEL_SCALE_CLOUD
import geovista.theme

Could you also give that a try please?

Thanks 👍

@bjlittle
Copy link
Owner

bjlittle commented Jul 4, 2024

@all-contributors please add @felixdellner for bug and ideas

Copy link
Contributor

@bjlittle

I've put up a pull request to add @felixdellner! 🎉

@felixdellner
Copy link
Author

@bjlittle Huge thanks for the quick reply Bill and the great library!
It works just fine on my work Mac and in a separate Notebook.
I tried both approaches, and now it compiles! :)

However, now I get a blank frame.

(Assuming you meant os.environ["EAGER_IMPORT"] = "disable" for a way around the lazy loading)

@bjlittle
Copy link
Owner

bjlittle commented Jul 4, 2024

@felixdellner My pleasure!

Thanks for getting back 👍

Okay, this is really useful to know. I might document this for the community as a known issue within vscode.

There may be a way to resolve this without disabling lazy importing, but that'll require a wee bit of investigation on my behalf 👍

Yup, just setting the environment variable to anything triggers disabling the lazy loader. Nice one.

So are you happy for now with this work around?

If so, then please close this issue and I'll spin up another separate one to follow-up with some investigations.

Otherwise, happy to keep this issue open and assist further, if I can.

Thanks 👍

@bjlittle
Copy link
Owner

bjlittle commented Jul 5, 2024

However, now I get a blank frame.

What do you mean? Can you explain further or show me a screenshot?

@felixdellner
Copy link
Author

However, now I get a blank frame.

What do you mean? Can you explain further or show me a screenshot?

Sure thing, now it looks like this:
image

I'll close this issue (while I'd say the problem remains, I agree that this particular issue might not be the best place to deal with it.)

@bjlittle
Copy link
Owner

bjlittle commented Jul 11, 2024

@felixdellner I've done a bit more digging into this, and I've decided to re-open this issue as I believe that I've not fully implemented lazy loading correctly within geovista, given my rediscovery of https://scientific-python.org/specs/spec-0001/#type-checkers.

I'd like to attempt to re-address this, if you've still got the time and motivation to kick the tyres ?

@bjlittle bjlittle moved this to 🚀 In Progress in 🦊 GeoVista v0.6.0 Aug 1, 2024
@bjlittle bjlittle moved this from 🚀 In Progress to 🔖 Assigned in 🦊 GeoVista v0.6.0 Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scipy 2024 type: bug Auto-labelled for bug/*, fix/* and patch/* branches
Projects
Status: 🔖 Assigned
Development

No branches or pull requests

2 participants