google / weather-tools

Tools to make weather data accessible and useful.

Home Page:https://weather-tools.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to run command line tools on Windows

CillianFn opened this issue · comments

This might be just an issue for me on Windows but I am unable to run the command line tools after installing them via
pip install git+http://github.com/google/weather-tools.git#egg=weather-tools

E.g.
C:\Users\Cillian>weather-dl configs/era5_example_config_local_run.cfg --local-run 'weather-dl' is not recognized as an internal or external command, operable program or batch file.

Edition: Windows 10 Home
Version: 21H1
OS build 19043.1415

64-bit Operating System

Python version: 3.8.5

I can see the following under c:\users\cillian\appdata\local\programs\python\python38\lib\site-packages (0.1.dev176+g7faf96c)

image

Thanks for catching this. Let's see if we can debug your installation. A couple of thoughts & questions:

  • Is this a global install of weather-tools? What would happen if we installed it inside a virtual env or an Anaconda env?
  • weather-dl should be in a bin/ folder inside site-packages. See if you can locate it. Can you run that file directly? What are the permissions on that file? Is this directory in your path?
  • These docs indicate that the lack of a .py extension could be a problem on windows. Can you follow up with their recommendation to see if it helps? If this is the culprit, then I think the fix will be to add back the extension.

I hope these debugging starting points help.

Thanks for the suggestions @alxmrs 😃

  • I've tried both global installation and installation in an Anaconda env (weather-tools is showing up when I run conda list from the env).
  • I can't seem to see a /bin folder anywhere in /site-packages (weather-tools related folders/files look the same in global installation and anaconda env installation)
  • I also came across those docs earlier and tried adding .py to the PATHEXT environment variable with no luck. Running weather-dl.py ..... and python weather-dl.py ..... was also unsuccessful.

I'm reluctant to spend more time on this but happy to be your guinea pig if Windows compatibility is a need/want on your end. Seeing as pytype is not compatible with Windows and recommends using WSL, I'm thinking of going down that route as an alternative.

Something that I'm conscious of is having no reference to weather-tools anywhere in my environment variables so maybe I just need to point my Path in the right direction. I'll try a few things and get back to you here.

check this out
[https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho]link

Some more findings...

  • Bin folders do not exist in site-packages on Windows. Bin folder contents are stored in Scripts See commit message / code -> pypa/virtualenv@993ba13

  • When looking in the Scripts folder, there are weather-dl etc. files of type file, but they do not have an executable (attempted adding this file path to Path with no luck.
    image

  • Found similar issue, which was solved by updating setup.py to use console scripts entry points instead of scripts. Hoping this solves the issue!

I've explored using console scripts entry points, but preferred scripts mainly to have our beam pipelines act as pip-installable CLIs. I think it's possible to update our setup.py to use console script entry points, but I want to warn you now: this will be tricker than is initially appears.

Cillian, are you planning on investigating (or currently implementing) this fix?

@alxmrs thanks! I plan on continuing investigating with this but haven't gotten around to it yet.