mesa-geo icon indicating copy to clipboard operation
mesa-geo copied to clipboard

Installing mesa-geo in Windows 10

Open NickGotts opened this issue 4 years ago • 13 comments

Has anyone succeeded in installing mesa-geo on Windows 10? I have tried both methods suggested, in Anaconda. HEre's the error message:

ERROR: Command errored out with exit status 1: command: 'C:\Users\NMG\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\NMG\AppData\Local\Temp\pip-install-x7ykh3k9\fiona\setup.py'"'"'; file='"'"'C:\Users\NMG\AppData\Local\Temp\pip-install-x7ykh3k9\fiona\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\NMG\AppData\Local\Temp\pip-pip-egg-info-sxn218qg' cwd: C:\Users\NMG\AppData\Local\Temp\pip-install-x7ykh3k9\fiona
Complete output (1 lines): A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable. ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

So I try installing gdal, using the recommended command: conda install -c conda-forge gdal This comes up with pages of "conflicts", and does not appear to work. Any advice gratefully received.

NickGotts avatar Nov 20 '20 13:11 NickGotts

I have developed mesa-geo using windows 10, so it used to be no problem. I'll see if I can recreate the problem on my end, but it will take a few days until I have the resources. You could see if it is possible to install gdal differently

Corvince avatar Nov 20 '20 18:11 Corvince

Thanks very much - that's already useful information. I was going to try on a Linux machine, but I'll try on a different Windows 10 machine instead - or first, at least. I'll let you know the outcome.

Regards, Nick

I have developed mesa-geo using windows 10, so it used to be no problem. I'll see if I can recreate the problem on my end, but it will take a few days until I have the resources. You could see if it is possible to install gdal differently

-- You are receiving this because you authored the thread.

Reply to this email directly or view it on GitHub:

https://github.com/Corvince/mesa-geo/issues/30#issuecomment-731346751

NickGotts avatar Nov 21 '20 09:11 NickGotts

Hi, just to let you know I have now succeeded (on another machine, but I think the same steps will work on the original, which is the one i need it on if possible). I'll post a reply to my own query, probably tomorrow.

Thanks again - without knowing you'd developed it on Windows, I'd have given up hours ago! Nick

I have developed mesa-geo using windows 10, so it used to be no problem. I'll see if I can recreate the problem on my end, but it will take a few days until I have the resources. You could see if it is possible to install gdal differently

-- You are receiving this because you authored the thread.

Reply to this email directly or view it on GitHub:

https://github.com/Corvince/mesa-geo/issues/30#issuecomment-731346751

NickGotts avatar Nov 22 '20 17:11 NickGotts

I have now succeeded (at least in installing mesa-geo; I have not yet tried to use it). The error message above appeared while the system was trying to install Fiona. Downloading two files from https://www.lfd.uci.edu/~gohlke/pythonlibs/, and using the following commands from within an Anaconda powershell terminal worked:

pip install C:\GDAL-3.1.4-cp38-cp38-win_amd64.whl pip install C:\Fiona-1.8.18-cp38-cp38-win_amd64.whl pip install mesa-geo

The last of these used the previously downloaded mesa_geo-0.2.0-py3-none-any.whl.

NickGotts avatar Nov 23 '20 11:11 NickGotts

Worth noting that, running Python3.8.3, under anaconda, I needed to make two changes to get the GeoSIR example to run:

  1. Copy the files geos.dll and geos_c.dll from \path\to\anaconda3\Lib\site-packages\shapely\DLLs to \path\to\anaconda3\Library\bin. I don't know why; adding to python's path did not work.
  2. Add the lines: if sys.platform == 'win32': asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) to get round a change in Python3.8, as recommended here: https://github.com/tornadoweb/tornado/issues/2751.

NickGotts avatar Nov 23 '20 15:11 NickGotts

Glad you got it working! I'll leave this open until I can try this again myself on a clean environment and also to fix the visualization server

Corvince avatar Nov 25 '20 11:11 Corvince

I just reinstalled mesa-geo in a new virtual environment, and found that the file-copying noted above was not needed - the files geos.dll and geos_c.dll were already in \path\to\anaconda3\Library\bin. I also found that the two lines needing to be added to tornado\platform\asyncio.py are needed for the mesa example boids as well as mesa-geo examples.

NickGotts avatar Dec 10 '20 12:12 NickGotts

I installed mesa and mesa-geo on Windows 10 (still need to install GDAL and Fiona as described above to get the server to run without errors - this is a GeoPandas issue). The mesa schilling example runs, but the mesa-geo Schilling example does not. I get a map window, but the red and blue country outlines do not appear, nor do the controls. Installing with the same requirements.txt on Linux everything runs fine.

Note that the tornado\platform\asyncio.py update should not be needed with Tornado 6.1 (https://github.com/tornadoweb/tornado/issues/2608#issuecomment-736185273), but I tried it anyways with no joy.

Here is what I get on Windows 10:

image

I'm running Python 3.8. Here is my requirements.txt: rrow==1.2.1 attrs==21.2.0 beautifulsoup4==4.10.0 binaryornot==0.4.4 certifi==2021.10.8 chardet==4.0.0 charset-normalizer==2.0.8 click==8.0.3 click-plugins==1.1.1 cligj==0.7.2 cookiecutter==1.7.3 cycler==0.11.0 Fiona==1.8.20 fonttools==4.28.2 geopandas==0.10.2 idna==3.3 install==1.3.4 Jinja2==3.0.3 jinja2-time==0.2.0 kiwisolver==1.3.2 libpysal==4.5.1 MarkupSafe==2.0.1 matplotlib==3.5.0 Mesa==0.8.9 -e git+https://github.com/corvince/mesa-geo.git@f5dc628c3674c7faa42c3a4d2053d6cc69f6fa5e#egg=mesa_geo munch==2.5.0 networkx==2.6.3 numpy==1.21.4 packaging==21.3 pandas==1.3.4 Pillow==8.4.0 poyo==0.5.0 pyparsing==3.0.6 pyproj==3.3.0 python-dateutil==2.8.2 python-slugify==5.0.2 pytz==2021.3 requests==2.26.0 Rtree==0.9.7 scipy==1.7.3 setuptools-scm==6.3.2 Shapely==1.8.0 six==1.16.0 soupsieve==2.3.1 text-unidecode==1.3 tomli==1.2.2 tornado==6.1 tqdm==4.62.3 urllib3==1.26.7

rcriii42 avatar Nov 28 '21 14:11 rcriii42

@josse7cz that is a symptom of 2 possible problems:

  • You have a file called geopandas.py locally: https://stackoverflow.com/questions/49731879/attributeerror-module-pandas-has-no-attribute-version
  • You just need to reinstall the dependencies, see https://github.com/ipython/ipyparallel/issues/349

You should have posted your problem in a new issue, because while it is a Windows installation problem just like this issue, it has a different unrelated error message.

rht avatar Apr 19 '22 07:04 rht

How can I install mesa-geo as editable pip install -e git+https://github.com/projectmesa/mesa-geo.git#egg=mesa-geo , when I try to execute this command it gives me the following error

 ERROR: Command errored out with exit status 1:
   command: 'C:\Users\user\Desktop\RA\pythonProject20\venv\Scripts\python.exe' 'C:\Users\user\Desktop\RA\pythonProject20\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.p
y' get_requires_for_build_wheel 'C:\Users\user\AppData\Local\Temp\tmpddvlq5v2'
       cwd: C:\Users\user\AppData\Local\Temp\pip-install-o9mxfdrm\rasterio_fe13844a995745cd82fdd2205697e9f0
  Complete output (2 lines):
  INFO:root:Building on Windows requires extra options to setup.py to locate needed GDAL files. More information is available in the README.
  ERROR: A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.

Initially I installed mesa geo by executing the following commands

pip install C:\GDAL-3.1.4-cp38-cp38-win_amd64.whl
pip install C:\Fiona-1.8.18-cp38-cp38-win_amd64.whl
pip install mesa-geo

But now I want to make changes in the root code so I want to install it so that I can edit the root code. I am unable to install GDAL as editable. Can anyone suggest me the steps I should take?

Harshpanday avatar Jun 17 '22 21:06 Harshpanday

@Harshpanday can you post in a different issue? Your use case is different from OP's. That said, I don't have access to a Windows machine, and so, can't help debug.

rht avatar Jun 18 '22 08:06 rht

The error seems to be related to rasterio. This isn't included in the latest release, but on the git version. So it is probably a problem with the installation of rasterio and not normal install vs editable install, but we need to verify this.

Also, yes, a separate issue would be great

Corvince avatar Jun 18 '22 08:06 Corvince

This is an old issue but I would like to use this as the ticket to track installation issues in Windows OS.

In our readme file we mentioned

On windows you should first use Anaconda to install some of the requirements with

conda install fiona pyproj rtree shapely pip install mesa-geo

However, this was written 5 or 6 years ago. As I don't have access to any Windows machine, it would be great if someone could help check whether there is any issue in installing Mesa-Geo in Windows OS.

I'm also curious to know whether the conda install is still required, or in other words, will there be any problem if we simply run pip install mesa-geo in Windows.

wang-boyu avatar Apr 16 '23 00:04 wang-boyu

I tried pip install mesa-geo on a Windows 10 laptop with Python 3.10 and it works. I will close this issue and remove the condo install part from the README file.

wang-boyu avatar Jul 10 '24 07:07 wang-boyu