Closed ReagentX closed 2 years ago
I get exactly the same issue running basemap with windows 10.
I am using basemap 1.2.2 and python 3.8.6
http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/export?bbox=2506055.846693921,4410720.871992808,2506637.203006063,4411028.421318711&bboxSR=3110&imageSR=3110&size=1000,529&dpi=100&format=png32&transparent=true&f=image
Traceback (most recent call last):
File "C:\Machine Learning\Casey Datasets\Balwyn_Map.py", line 12, in
I need to solve this issue!
I have the same issue.
# Name Version Build Channel
basemap 1.2.2 py38h85717e3_3 conda-forge
basemap-data-hires 1.2.2 0 conda-forge
matplotlib 3.3.3 py38h578d9bd_0 conda-forge
matplotlib-base 3.3.3 py38h5c7f4ab_0 conda-forge
pillow 8.0.1 py38h70fbd49_0 conda-forge
python 3.8.6 h852b56e_0_cpython conda-forge
---------------------------------------------------------------------------
UnsupportedOperation Traceback (most recent call last)
<ipython-input-37-05bc67db5411> in <module>
15 linewidth=0.5
16 )
---> 17 bm.arcgisimage(service="World_Shaded_Relief",
18 xpixels=3000,
19 verbose=True)
~/local/anaconda3/envs/py38a/lib/python3.8/site-packages/mpl_toolkits/basemap/__init__.py in arcgisimage(self, server, service, xpixels, ypixels, dpi, verbose, **kwargs)
4271 if verbose: print(basemap_url)
4272 # return AxesImage instance.
-> 4273 return self.imshow(imread(urlopen(basemap_url)),ax=ax,
4274 origin='upper')
4275
~/local/anaconda3/envs/py38a/lib/python3.8/site-packages/matplotlib/image.py in imread(fname, format)
1494 response = io.BytesIO(response.read())
1495 return imread(response, format=ext)
-> 1496 with img_open(fname) as image:
1497 return (_pil_png_to_float_array(image)
1498 if isinstance(image, PIL.PngImagePlugin.PngImageFile) else
~/local/anaconda3/envs/py38a/lib/python3.8/site-packages/PIL/ImageFile.py in __init__(self, fp, filename)
119 try:
120 try:
--> 121 self._open()
122 except (
123 IndexError, # end of data
~/local/anaconda3/envs/py38a/lib/python3.8/site-packages/PIL/PngImagePlugin.py in _open(self)
690 # get next chunk
691
--> 692 cid, pos, length = self.png.read()
693
694 try:
~/local/anaconda3/envs/py38a/lib/python3.8/site-packages/PIL/PngImagePlugin.py in read(self)
160 s = self.fp.read(8)
161 cid = s[4:]
--> 162 pos = self.fp.tell()
163 length = i32(s)
164
UnsupportedOperation: seek
This pull request is supposed to fix the problem:
https://github.com/matplotlib/basemap/pull/505
You are welcome to try and test it and maybe there will be more motivation to merge it.
Sasha
Thanks for your efforts. Is there a version of basemap I can use that will work with arcgisimage?
Peter
From: Huziy Oleksandr (Sasha) notifications@github.com Sent: Wednesday, December 2, 2020 3:21 AM To: matplotlib/basemap basemap@noreply.github.com Cc: metonics peterryan2005@hotmail.com; Comment comment@noreply.github.com Subject: Re: [matplotlib/basemap] arcgisimage() fails with io.UnsupportedOperation: seek (#499)
This pull request is supposed to fix the problem:
You are welcome to try and test it and maybe there will be more motivation to merge it.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fbasemap%2Fissues%2F499%23issuecomment-736658792&data=04%7C01%7C%7C6a4b1726bfe044f6476508d896151e94%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637424364730232810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=hPbc%2BzDDyI1PZrJXiFHxKFFtZ18ql0jSEHJaAWdevY0%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARORH5IOFXSKKHICMF7NRLDSSUJXPANCNFSM4Q2FSIXA&data=04%7C01%7C%7C6a4b1726bfe044f6476508d896151e94%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637424364730232810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0qTCunNYpe1fNi8GiVViDpLVZJSzgEMBwCulcLiA74w%3D&reserved=0.
Yes Peter:
Please test the one in my repo: https://github.com/guziy/basemap/tree/fix_arcgis_image
Just use the fix_arcgis_image branch.
When you checkout the branch try using
pip install . -U --user
You might need to specify the path to geos installation:
$(geos-config --prefix) pip install . -U --user
Cheers
Sasha
Sorry – I need more help
How do I get the .whl file from github to install? Or should this line work?
py -m pip install --user git+https://github.com/guziy/basemap/tree/fix_arcgis_image/basemap.git
I am using windows 10
Peter
From: Huziy Oleksandr (Sasha) notifications@github.com Sent: Friday, December 4, 2020 9:06 AM To: matplotlib/basemap basemap@noreply.github.com Cc: metonics peterryan2005@hotmail.com; Comment comment@noreply.github.com Subject: Re: [matplotlib/basemap] arcgisimage() fails with io.UnsupportedOperation: seek (#499)
Yes Peter:
Please test the one in my repo: https://github.com/guziy/basemap/tree/fix_arcgis_imagehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fguziy%2Fbasemap%2Ftree%2Ffix_arcgis_image&data=04%7C01%7C%7Cfcc36336c83a4107e6ba08d897d7a0aa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637426299647320341%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2F5vbDpIRlYS3lsCf7P09OnP5CVKUeVECXJ3bEQNmwNQ%3D&reserved=0
Just use the fix_arcgis_image branch.
When you checkout the branch try using
pip install . -U --user
You might need to specify the path to geos installation:
$(geos-config --prefix) pip install . -U --user
Cheers
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fbasemap%2Fissues%2F499%23issuecomment-738347709&data=04%7C01%7C%7Cfcc36336c83a4107e6ba08d897d7a0aa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637426299647330339%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DAXHc9nZz8bm2umOPlV3cC4GyvNdbFbNqNctQ0MBHgQ%3D&reserved=0, or unsubscribehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARORH5IURBVA55YHDFY3VLLSTADUVANCNFSM4Q2FSIXA&data=04%7C01%7C%7Cfcc36336c83a4107e6ba08d897d7a0aa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637426299647340318%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JljIR%2FtRJ56jXQPQ95B32f4uMEhAvV6aAU%2FeveGNCZI%3D&reserved=0.
Sorry, Peter:
I have no idea about windows, the commands I wrote are for Linux, might work on a mac...
Cheers
Sasha
Windows/DOS installation very similar to linux
In windows/DOS this installs a version of basemap that still has the seek error
py -m pip install git+https://github.com/guziy/basemap.git
but if I do this and try to install the fix_arcgis_image version I get
C:\Windows\system32>py -m pip install git+https://github.com/guziy/basemap/tree/fix_arcgis_image Collecting git+https://github.com/guziy/basemap/tree/fix_arcgis_image Cloning https://github.com/guziy/basemap/tree/fix_arcgis_image to c:\users\peter\appdata\local\temp\pip-req-build-chx_u_x6 ERROR: Command errored out with exit status 128: git clone -q https://github.com/guziy/basemap/tree/fix_arcgis_image 'C:\Users\peter\AppData\Local\Temp\pip-req-build-chx_u_x6' Check the logs for full command output.
Is there some issue with that repo?
Regards
Peter
From: Huziy Oleksandr (Sasha) notifications@github.com Sent: Saturday, December 5, 2020 3:19 AM To: matplotlib/basemap basemap@noreply.github.com Cc: metonics peterryan2005@hotmail.com; Comment comment@noreply.github.com Subject: Re: [matplotlib/basemap] arcgisimage() fails with io.UnsupportedOperation: seek (#499)
Sorry, Peter:
I have no idea about windows, the commands I wrote are for Linux, might work on a mac...
Cheers
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fbasemap%2Fissues%2F499%23issuecomment-738873855&data=04%7C01%7C%7C5d0dd02aba4946bd7ba308d8987046d7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637426955271633154%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Cht5OcwcNjw0N620dIX3Rbseo8rFGXWnNFW7GXv5Qis%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARORH5NRLVD2PPOQ3AMACJ3STEDWNANCNFSM4Q2FSIXA&data=04%7C01%7C%7C5d0dd02aba4946bd7ba308d8987046d7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637426955271633154%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=sAO5ccbFVrWwVVCmRIo4MuTfErJa%2FNI3wnAcPZwO8Yw%3D&reserved=0.
I guess you need to specify the correct branch as they say here. Sorry I just sent you the HTML view link...
https://stackoverflow.com/questions/20101834/pip-install-from-git-repo-branch
pip install git+git@github.com:guziy/basemap.git@fix_arcgis_image
or https
pip install git+https://github.com/guziy/basemap.git@fix_arcgis_image
Cheers
Dear Sasha
Yes, that installs fine on Windows 10.
pip install git+git@github.com:guziy/basemap.git@fix_arcgis_imagemailto:git+git@github.com:guziy/basemap.git@fix_arcgis_image
However I still get the seek error?
Traceback (most recent call last):
File "C:\Machine Learning\Waste\WCC_Bin_Map_URL.py", line 22, in
I am moving to Cartopy so if it is too hard to fix this issue, I suggest abandoning it!
Regards
Peter
From: Huziy Oleksandr (Sasha) notifications@github.com Sent: Tuesday, December 8, 2020 6:06 AM To: matplotlib/basemap basemap@noreply.github.com Cc: metonics peterryan2005@hotmail.com; Comment comment@noreply.github.com Subject: Re: [matplotlib/basemap] arcgisimage() fails with io.UnsupportedOperation: seek (#499)
I guess you need to specify the correct branch as they say here. Sorry I just sent you the HTML view link...
https://stackoverflow.com/questions/20101834/pip-install-from-git-repo-branchhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F20101834%2Fpip-install-from-git-repo-branch&data=04%7C01%7C%7C7f333c6d63604acdfd7508d89ae32e74%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637429647808503529%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9epPX3Y7n32uiuWpGe%2FjvkiEoxH%2FbsWPGA59ussGB84%3D&reserved=0
pip install git+git@github.com:guziy/basemap.git@fix_arcgis_imagemailto:git+git@github.com:guziy/basemap.git@fix_arcgis_image
or https
pip install git+https://github.com/guziy/basemap.git@fix_arcgis_image
Cheers
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fbasemap%2Fissues%2F499%23issuecomment-740118380&data=04%7C01%7C%7C7f333c6d63604acdfd7508d89ae32e74%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637429647808503529%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=81D6hZAj8SGOwWNrfM%2BxZH%2Fcb7fWPJhReWKiKEJCDtA%3D&reserved=0, or unsubscribehttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARORH5PF3BZYMF4AX5V7NF3STURSXANCNFSM4Q2FSIXA&data=04%7C01%7C%7C7f333c6d63604acdfd7508d89ae32e74%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637429647808513525%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=zTnpid5%2B00sSon3PHPGeB9XaHCuSxEf3efyCqTrnXDs%3D&reserved=0.
It is a good idea to move to cartopy. But your error message is still saying it is using imread, whereas in my version of the code imread is removed...
Not sure how you install or use things, but you might still be using some other version of basemap...
PS: please use the GitHub interface for messages, it is hard to follow when your email client copies so many links...
Cheers
pip install git+https://github.com/guziy/basemap.git@fix_arcgis_image - eventually worked to install the forked version
Thanks for all your efforts!
Yes, it is now working - or at least not crashing. I am having issues getting the imagery to load up however and will do more investigation with the test codes.
this seems to now work correctly. I was having issues with the epsg parameter - If I leave it off the images install fine.
I just merged the PR #505 by @guziy into the master
branch, this problem should be fixed now.