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

Installing mesa-geo in Windows 10 #30

Closed
NickGotts opened this issue Nov 20, 2020 · 14 comments
Closed

Installing mesa-geo in Windows 10 #30

NickGotts opened this issue Nov 20, 2020 · 14 comments
Labels
help wanted sprint A task that might be good to tackle during sprints!

Comments

@NickGotts
Copy link

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.

@Corvince
Copy link
Contributor

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

@NickGotts
Copy link
Author

NickGotts commented Nov 21, 2020 via email

@NickGotts
Copy link
Author

NickGotts commented Nov 22, 2020 via email

@NickGotts
Copy link
Author

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
Copy link
Author

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: python 3.8 changes default asyncio loop on windows https://bugs.python.org/issue37373 tornadoweb/tornado#2751.

@Corvince
Copy link
Contributor

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

@NickGotts
Copy link
Author

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.

@rcriii42
Copy link

rcriii42 commented Nov 28, 2021

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 (tornadoweb/tornado#2608 (comment)), 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

@rht
Copy link
Contributor

rht commented Apr 19, 2022

@josse7cz that is a symptom of 2 possible problems:

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.

@Harshpanday
Copy link

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?

@rht
Copy link
Contributor

rht commented Jun 18, 2022

@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.

@Corvince
Copy link
Contributor

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

@wang-boyu wang-boyu added help wanted sprint A task that might be good to tackle during sprints! labels Apr 16, 2023
@wang-boyu
Copy link
Member

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted sprint A task that might be good to tackle during sprints!
Projects
None yet
Development

No branches or pull requests

6 participants