Giter VIP home page Giter VIP logo

Comments (50)

choldgraf avatar choldgraf commented on June 12, 2024 1

Try setting the mpl backend to something else before importing geoplot. Eg "mpl.use("qt5")"

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024 1

Try installing cartopy first with conda using conda forge... Cartopy has some nasty dependencies that easily break. It's super annoying. I think it's:

"conda install -c conda-forge cartopy"

After you remove cartopy

from geoplot.

ResidentMario avatar ResidentMario commented on June 12, 2024

Hmm. There hasn't been a release between then and now, so you mean on the current geopandas master, right?

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

yep - this'll be a future breaking change...just forwarning you :-)

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

Has this been resolved? I just created a new conda enviornment (GeoPlot), installed geopandas and geoplot using (conda install geo*). I get this message when I try to import geoplot:

Traceback (most recent call last):
File "MapFLCounties.py", line 2, in
import geoplot as gplt
File "/anaconda/envs/GeoPlot/lib/python3.5/site-packages/geoplot/init.py", line 9, in
from .geoplot import *
File "/anaconda/envs/GeoPlot/lib/python3.5/site-packages/geoplot/geoplot.py", line 6, in
from geopandas.plotting import __pysal_choro, norm_cmap
ImportError: cannot import name 'norm_cmap'

Is there a solution?

By the way, running on Mac.

from geoplot.

ResidentMario avatar ResidentMario commented on June 12, 2024

This is now a present incompatibility with geopandas 0.3.0.

I was dissatisfied with the low-level API for this anyway, so I will probably do a rewrite for this segment of the code. I also probably need to write a proper viz testing shim (like geopandas/tests/test_plotting.py?) first.

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

Is there an earlier version of geopandas that will work?

from geoplot.

ResidentMario avatar ResidentMario commented on June 12, 2024

@rsgoldfarb For the moment the solution is to downgrade to [email protected]. Hotfix soon.

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

@ResidentMario

Sorry, I hope you don't mind helping me through this. My problem may not be entirely due to geoplot (although my first one was). Here's what I tried to do.

  1. Created a new Python 3.5 environment
  2. installed geoplot and geopandas using: conda install geoplot geopandas==0.2.1
  3. tried to import geopandas - worked with no problem
  4. tried to import geoplot - got this error:
    Assertion failed: (0 != cs), function GEOSCoordSeq_setOrdinate_r, file geos_ts_c.cpp, line 3657.

The reason I say this might not be due to geoplot is that a week or so ago I was using geopandas, matplotlib and basemap to plot a US map with polygons from a GeoDataFrame added. It was working without any problems. But then I was trying to add a FEMA flood zone shapefile to the process and struggled to find an open-source tool to properly convert the FEMA KMZ files to GeoDataFrame. In the process, I tried MANY different packages and tools, including QGIS and others. Then, all of a sudden, my working code failed and I got all sorts of package conflicts - always related to conflicting versions of GDAL, PROJ4, shapely, etc.

What all of that relates to is that the same error I just got and noted above is among the errors I was seeing earlier in the week when I struggled to sort out the conflicts. At one point I was using cartopy alone and got the same message (I get the same message now in the new environment trying to import cartopy).

So, I think my issue might be related to something else I downloaded, unrelated to my virtual environment, such as GDAL or QGIS, that is giving me all of these headaches. I've spent about 15 hours so far with no luck. Can you help?

from geoplot.

ResidentMario avatar ResidentMario commented on June 12, 2024

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

from geoplot.

ResidentMario avatar ResidentMario commented on June 12, 2024

SciTools/cartopy#805 is the issue you want. Dropping a note there to help push the devs towards decisive action would be helpful. :)

This issue has been addressed in a [email protected] hotfix. You can get the latest version (with the fix) by running pip install -U geoplot. I also updated the conda-forge package (used by conda) but I believe that will take a bit more time to propagate.

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

Not quite there yet...here's what I just tried.

  1. Created a new conda environment
  2. ran: pip install -U geoplot
  3. import geopandas -- No Error
  4. import geoplot -- Got the following errors:

Traceback (most recent call last):
File "", line 1, in
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/anaconda/envs/geo_test/lib/python3.5/site-packages/geoplot/init.py", line 9, in
from .geoplot import *
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/anaconda/envs/geo_test/lib/python3.5/site-packages/geoplot/geoplot.py", line 7, in
import matplotlib.pyplot as plt
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/anaconda/envs/geo_test/lib/python3.5/site-packages/matplotlib/pyplot.py", line 115, in
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/anaconda/envs/geo_test/lib/python3.5/site-packages/matplotlib/backends/init.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/anaconda/envs/geo_test/lib/python3.5/site-packages/matplotlib/backends/backend_macosx.py", line 19, in
from matplotlib.backends import _macosx
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.

If it helps, here's what's installed in the environment:
image

from geoplot.

ResidentMario avatar ResidentMario commented on June 12, 2024

No idea what the issue is there as that strikes me as being impossible. Wait until the conda package gets updated (when you see a 0.0.4 entry after running conda search geoplot).

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

That doesn't look like a geoplot error to me... That' framework python error is an annoying problem for osx users in general... I think I've figured it out before from googling but don't remember the exact fix :-\

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

@choldgraf Thanks, fixing the matplotlib backend addressed the "framework" issue. However, now I get this error trying to import geoplot:

Traceback (most recent call last):
File "/Users/GoldfarbSeminars/Dropbox (Ventus)/Ventus/Python Code/FLCountiesMap/MapFLCounties.py", line 2, in
import geoplot as gplt
File "/anaconda/envs/geo2/lib/python3.5/site-packages/geoplot/init.py", line 9, in
from .geoplot import *
File "/anaconda/envs/geo2/lib/python3.5/site-packages/geoplot/geoplot.py", line 10, in
from cartopy.feature import ShapelyFeature
File "/anaconda/envs/geo2/lib/python3.5/site-packages/cartopy/init.py", line 110, in
import cartopy.crs
File "/anaconda/envs/geo2/lib/python3.5/site-packages/cartopy/crs.py", line 36, in
from cartopy._crs import CRS, Geocentric, Geodetic, Globe, PROJ4_VERSION
ImportError: dlopen(/anaconda/envs/geo2/lib/python3.5/site-packages/cartopy/_crs.cpython-35m-darwin.so, 2): Library not loaded: @rpath/libproj.9.dylib
Referenced from: /anaconda/envs/geo2/lib/python3.5/site-packages/cartopy/_crs.cpython-35m-darwin.so
Reason: image not found

I searched online and there are lots of discussions related to this libproj.9.dylib error, all of which relate to problems with gdal versions. I've confirmed that gdal and libgdal are the same versions (that was one commonly reported problems and solutions). Others suggested using conda-forge to install cartopy, but as noted above the 0.0.4 version of geoplot isn't on the conda-forge channel yet. So I installed geoplot with pip install -U geoplot.

Any help would be GREATLY appreciated. I have 20+ hours into trying to address these issues and still no luck at all!

Here is my current environment:
image

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

@choldgraf @ResidentMario Thanks for your patience. I have more info to share that might help. I tried installing cartopy first, but that didn't seem to work. But then I thought maybe I need to be careful about using pip vs. conda-forge and did the following test. I created a new environment and thought I would install using pip in the following order - fiona, gdal, cartopy, geoplot.

As soon as I tried to do pip install gdal, I got this error (note the bold portion):

Collecting gdal
Using cached GDAL-2.2.1.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/GDAL.egg-info
writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
writing pip-egg-info/GDAL.egg-info/PKG-INFO
writing manifest file 'pip-egg-info/GDAL.egg-info/SOURCES.txt'
Traceback (most recent call last):
File "/private/var/folders/d4/bcrwm05n3sj56j0bg5snkq4m0000gq/T/pip-build-rg7i0knl/gdal/setup.py", line 131, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/anaconda/envs/geopip/lib/python3.5/subprocess.py", line 676, in init
restore_signals, start_new_session)
File "/anaconda/envs/geopip/lib/python3.5/subprocess.py", line 1289, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'

Again, this problem seemed to all start when I installed QGIS, which involved installing GDAL. Could that somehow be the source of these issues? I've read somewhere that there might be a difference between installing GDAL using the KyngChaos dmg (GDAL 2.1 Complete), which I did as part of the QGIS install, and installing gdal in the python environment. Am I supposed to have done both? If I was wrong to run the dmg and install GDAL somewhere, is there a way to remove it?

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

@choldgraf @ResidentMario Here's an update...

I was able to fix the gdal-config issue after carefully reviewing the instructions for gdal and making an edit to the .cfg file to ensure the right path.

That fixed the issue above, but then I again was getting the original error when trying to import geoplot:

Assertion failed: (0 != cs), function GEOSCoordSeq_setOrdinate_r, file geos_ts_c.cpp, line 3657.

After noticing that geoplot 0.0.4 was available on conda-forge, I went ahead and started over:

  1. I created a new environment
  2. I used the conda-forge channel to install the following, in this order:
  • gdal
  • fiona
  • shapely
  • cartopy
  • geopandas

Notice that I did not yet try to install geoplot. i just wanted to see what the above would get me.
3. I ran the following:
import geopandas
import matplotlib.pyplot as plt
import cartopy

Geopandas and matplotlib cause no problems, but cartopy gives me the same error:
Assertion failed: (0 != cs), function GEOSCoordSeq_setOrdinate_r, file geos_ts_c.cpp, line 3657.

I've been digging and digging and there seems to be a consensus that this is a shapely issue tied to a geos version. But I've read the discussion here (shapely/shapely#177) and it seems to suggest at the end of it all that conda-forge should work. I don't understand the earlier suggested solutions (e.g. "we always apply a patch which ensures that it is linking against <sys.prefix>/lib/libgeos_c.dylib") so I couldn't try those.

Something I also noticed, but may not be relevant, was that at one point in my testing different orders of installing packages conda wanted to downgrade gdal (from 2.2 to 2.1.3), but other packages required gdal 2.2. And at some point there was also a conflict with geotiff. But I don't know if those are related to this at all.

Here is what my environment looks like:
geospatialenv3.txt

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

yep - this sounds like my experience as well. Usually I just create a clean environment, install as many packages as possible with conda + conda-forge, and then try not to change / upgrade / etc anything after that. Until the dependency problems get worked out with gdal / fiona I think this will be a challenge for a while.

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

Does anyone know of the combination of channels/versions of gdal, fiona, shapely, geopandas, cartopy/geoplot that DOES work with Python 3.5? I'm happy to use anything that works. Someone must have an installation of these libraries that works, right? If anyone can post what works, I'm more than happy to start clean and build in whatever order doesn't wreak havoc. I just can't seem to stumble on the combination that works.

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

Here's an interesting sequence...

  1. Create a new environment
  2. immediately install geoplot with conda install -c conda-forge geoplot
  3. try to import geopandas, matplotlib and cartopy -> this leads to the geos_ts_c.cpp error
  4. UPGRADE fiona from 1.7.7-np112p35 from the conda-forge channel - this tries to install fiona 1.7.9-py35_1 and requires a DOWNGRADE of gdal from 2.2.1 to 2.1.3 (and zlib from 1.2.11 to 1.2.8). The error remains though.
  5. Now try to directly install fiona 1.7.7 (the one that got installed when installing geoplot) and gdal 2.1.3 (the one that the latest fiona requires) using conda install fiona==1.7.7 gdal==2.1.3

The result is a conflict. Fiona 1.7.7 requires gdal 2.2*! But the latest version of fiona 1.7.9 requires gdal 2.1.3.

Does this have anything to do with the problems I am having?

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

yikes - this is kind of brutal :-/ it's really annoying how hard it is to set up geospatial stacks in python.

Could you try creating a new environment and then using conda-forge install in this order:

  • cartopy
  • geopandas
  • matplotlib
  • geoplot

and see if that works?

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

Just tried that...got the same error (Assertion failed: (0 != cs), function GEOSCoordSeq_setOrdinate_r, file geos_ts_c.cpp, line 3657.) when trying to import geoplot.

Here's the environment when installing in the order suggested (note that geopandas downgraded zlib and matplotlib was already installed by a previous step, I assume cartopy).
geospatialenv5.txt

from geoplot.

ResidentMario avatar ResidentMario commented on June 12, 2024

conda create --name temp cartopy geopandas matplotlib geoplot -c conda-forge doesn't work on OSX?

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

Thanks for the help, but this is still causing problems -- only this time new ones!

Here's what I tried to do:

  1. Created a new Python 3.6 environment
  2. ran conda update --all
  3. ran conda install -c conda-forge cartopy geopandas matplotlib geoplot
  4. Got the following message: Installing conda-forge::pyshp-1.2.12-py_0 requires a minimum conda version of 4.3.################################################ | 52%
    And then I was back at my prompt, with the progress still at 52%, and none of the packages from pyshp on were installed. I've searched and cannot find any instructions for upgrading my version of conda that work. For instance, I tried conda update conda and conda update anaconda. Neither worked - it said "package conda is not installed in <environement."

The reason I tried this with Python 3.6 (I have always been using 3.5), is that I had previously tried it with 3.5 got the exact same error. I thought maybe 3.6 would work better.

I realize that this is getting off the original track, but I have to think these are all related?

from geoplot.

ResidentMario avatar ResidentMario commented on June 12, 2024

If conda --version doesn't return the latest version, try conda update conda and then try installing things again.

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

I tried that earlier, and just again. I get this error:
PackageNotFoundError: Package not found: 'conda' Package 'conda' is not installed in /Users//anaconda/envs/Py35GeoEnv

If it helps to sort this out at all, I was just using what I thought was a CLEAN environment and had no problems running a small script with bokeh. The list of installed packages is here:
Py35GeoEnv-spec-file.txt
I then tried to install geopandas using conda install -c conda-forge geopandas and when I tried to import geopandas.read_file I got the dreaded "Assertion failed: (0 != cs), function GEOSCoordSeq_setOrdinate_r, file geos_ts_c.cpp, line 3657."

from geoplot.

ResidentMario avatar ResidentMario commented on June 12, 2024

Try installing a fresh copy of conda off the website, then.

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

Okay, I am extremely appreciative of your help. Please hang in there!

I started by deleting ANY files on my computer with the text "gdal" - folders, files, etc. I then installed the GDAL 21 Complete dmg from here: http://www.kyngchaos.com/software:frameworks, which I've read is required separately from installing gdal in the virutal environment.

I then created a NEW Python 3.6 environment and ran the install as you directed (conda install -c conda-forge cartopy geopandas matplotlib geoplot. I then installed a few other items: bokeh (trying to avoid using basemap, cartopy or geoplot for the moment), reverse-geocoder and sqlalchemy-utils.

I then ran code that has worked in the past. If I comment out the one portion that imports geopandas and calls geopandas.read_file(), my code that queries a database and makes a map of points and a shapefile that has been converted to GeoJSON format already works perfectly fine.

However, if I include the code that imports geopandas and calls geopandas.read_file(), which is the step to read the original shapefile and then convert it to GeoJSON format (for use in Bokeh, which can only use GeoJSON), I get this error:

Process finished with exit code 138 (interrupted by signal 10: SIGBUS)

What's very strange about this is that this same code DID work earlier today with at least one version of the many environments I had created. To test this, I created a new Python 3.6 environment and ONLY installed geopandas, bokeh, reverse-geocoder and sqlachemy-utils. I left out cartopy, geoplot and matplotlib.

When the code is run, I get this error:

Assertion failed: (0 != cs), function GEOSCoordSeq_setOrdinate_r, file geos_ts_c.cpp, line 3657.
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

I then tried to check that I had the latest versions of geos, gdal and libgdal. For the first two, conda install said I had everything. But for libgdal, it said several items were needed, libgdal was updated and expat was downgraded (see screen shot below).

After the install of libgdal, I still got an error, but now the same error as I noted in my first attempt, not the same one with the "Assertion failed" text. The error this time is:

Process finished with exit code 138 (interrupted by signal 10: SIGBUS)

## Additional Info Added ##
To test this further, I also tried to create a new Python 3.5 environment and ONLY installed geopandas. I then ran this very simple code:

import geopandas as gpd
nhc_shapefile = 'al112017_2017091118_initialradii.shp'
nhc_df = gpd.read_file(nhc_shapefile, driver='ESRI Shapefile', enabled_drivers=['GeoJSON', 'ESRI Shapefile'])

This is the error I get:

Traceback (most recent call last):
  File "/Users/<redacted>/Python Code/BokehPlotTest/test geopandas.py", line 1, in <module>
    import geopandas as gpd
  File "/anaconda/envs/Py35GeoPandas/lib/python3.5/site-packages/geopandas/__init__.py", line 4, in <module>
    from geopandas.io.file import read_file
  File "/anaconda/envs/Py35GeoPandas/lib/python3.5/site-packages/geopandas/io/file.py", line 3, in <module>
    import fiona
  File "/anaconda/envs/Py35GeoPandas/lib/python3.5/site-packages/fiona/__init__.py", line 69, in <module>
    from fiona.collection import Collection, BytesCollection, vsi_path
  File "/anaconda/envs/Py35GeoPandas/lib/python3.5/site-packages/fiona/collection.py", line 9, in <module>
    from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: dlopen(/anaconda/envs/Py35GeoPandas/lib/python3.5/site-packages/fiona/ogrext.cpython-35m-darwin.so, 2): Library not loaded: @rpath/libnetcdf.11.dylib
  Referenced from: /anaconda/envs/Py35GeoPandas/lib/libgdal.20.dylib
  Reason: Incompatible library version: libgdal.20.dylib requires version 12.0.0 or later, but libnetcdf.11.dylib provides version 11.0.0

And here's the screen shot of what happened when I installed libgdal:

image

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

and just to double-check, you're only using conda-forge here right?

So the commands you ran above were:

after totally removing anaconda from your computer and re-installing from scratch

conda create --name myenv
source activate myenv
conda install -c conda-forge geopandas

then in python:

import geopandas
gpd.read_file(...

and it broke?

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

Well, not exactly. I haven't tried removing anaconda from my computer - I removed all references to GDAL. For Anaconda, I went to the root and did conda update conda.

The other nuance is that I am using the PyCharm Professional IDE. When I create a conda environment, I am doing that within PyCharm here:
image

I would be happy to remove Anaconda and reinstall. The other thing I haven't tried, but just thought of, is that maybe I can go to the root in the terminal and install all of these packages as directed into the root of my Mac, as opposed to in a virtual environment? Maybe that would overwrite something that is causing the problems???

Plus, is anyone able to confirm that I should or should not be installing the GDAL 2.1 dmg? I've read that this is not the same thing as doing conda install -c conda forge gdal. But is that correct. Should I be doing both?

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

Here's what I just tested to be sure this wasn't due to using the PyCharm IDE:

  1. I went to my root directory in the terminal
  2. I entered conda create --name TestGeoPandas
  3. I activated TestGeoPandas with source activate TestGeoPandas
  4. I installed geopandas from conda-forge with conda install -c conda-forge geopandas (see note below)
  5. From the root directory, I ran the file called testgeopandas.py, which contains the following commands:
import geopandas as gpd
nhc_shapefile = 'al112017_2017091118_initialradii.shp'
nhc_df = gpd.read_file(nhc_shapefile, driver='ESRI Shapefile', enabled_drivers=['GeoJSON', 'ESRI Shapefile'])

using python testgeopandas.py I tried to run the code.
6. I got the following:
image

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

hmm- from your error messages it looks like the geopandas being called is the base anaconda geopandas, not the one that you've installed with conda-forge (see the filepaths in the error message).

Could you print gpd.__file__?

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

How do I do that?

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

in python, just do print(gpd.__file__) after importing

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

ah - here's a question. you said you were using pycharm...did you install this with anaconda?

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

i activated the new environment, typed in python to get to the console and then imported geopandas as gpd and printed gpd.file:

image

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

did you type python from within pycharm? Or are you just doing this from your terminal?

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

what's confusing to me is that in this error message:

the paths are /anaconda/lib/python3.5/.... Whereas in the print(... statement you just posted, they are /anaconda/envs/TestGeoPandas/...

It looks like in the error message, it's actually looking at the default geopandas you have installed in root, not your conda-forge one

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

I did this all in the terminal.

For the latest test above, I didn't use PyCharm at all. At the terminal I created the new environment, installed geopandas, etc. And then I typed Python to get the console and tried to import geopandas.

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

so in the terminal you used to show the print(... statement, what happens when you do gpd.read_file(...

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

You're on to something. That works! I don't get the error.

Now I need to figure out what's different at the terminal vs. in PyCharm?

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

Sorry, I need to go offline for a few hours.

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

that's why I asked if you installed pycharm via conda

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

I think the problem is that pycharm has its own way of handling paths. So if you have pycharm installed under the default environment in anaconda, it is going to use the default packages when you import them. The way anaconda works is that if you create a new environment then try to import a package, it will first check in the new environment and if it doesn't find the package, it will import from the root environment (this is super dumb IMO). The same thing happens with Jupyter - if you create a new environment and install packages, but don't install the "jupyter" package, then when you type jupyter notebook it will default to the root environment.

So, you need to make sure what pycharm is somehow "installed" in your new environment as well. I'm not sure how to do this since I don't use pycharm, but that's the problem.

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

I haven't used geopolotics or cartoony, though this general approach has worked for me with conda-forge in the geospatial stack using python 3.6!

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

@choldgraf Wow, this is very strange.

I just removed PyCharm and all traces of Pycharm from my computer and reinstalled a new version. I retested the code from the terminal in the virtual environment created earlier and it worked without any issues.

I then tried to run the SAME code from within PyCharm and pointed to the SAME environment, and it failed with the 'Process finished with exit code 138 (interrupted by signal 10: SIGBUS)'. I then tried to create a new conda environment in PyCharm and installed ONLY geopandas, just as I did earlier from the terminal, and that too failed when the code was run, with the longer error:
'Assertion failed: (0 != cs), function GEOSCoordSeq_setOrdinate_r, file geos_ts_c.cpp, line 3657.
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)'

So, it seems that somewhere there is a system file pointing to the wrong place. But this is waaaay over my head! Any advice? I am going to try to remove all versions of python if I can and reinstall. But I am not sure how to go about that - do I just delete all folders in /Library/Frameworks/Python.framework/Versions and anything that says 'python x.x' in /Applications? That's what it said here (https://stackoverflow.com/questions/3950819/safe-way-to-uninstall-old-version-of-python), but it also said to "delete corresponding symlinks in /usr/local/bin, but I have no idea what that means!

from geoplot.

rsgoldfarb avatar rsgoldfarb commented on June 12, 2024

So...I deleted all traces of python and all traces of Anaconda and reinstalled everything. In the terminal I can create a new conda environment and run the code. But when I try to set the same environment in PyCharm, it fails. I also tried to create the environment in PyCharm and it still fails.

My guess was that PyCharm is searching my $PATH variable and finding a bad file in a way that running the code in the terminal isn't doing. However, I typed echo $PATH in the Mac terminal and in the PyCharm terminal and got the same path in both cases - with the first item being the conda environment both times. But, just to be safe, I removed two references in the $PATH to GDAL (one a frameworks path and one a gdal2 path). I really expected that to work...it didn't! The code still runs in the Mac terminal, but not in PyCharm.

And then it hit me - I wonder if it runs in the PyCharm terminal? Guess what? It does! Now how's that for a head scratcher???

I think it is time to look to JetBrains for support.

Thank you both for your patience and assistance.

from geoplot.

choldgraf avatar choldgraf commented on June 12, 2024

haha wow that sounds complicated....looks like you're getting closer though!

from geoplot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.