Closed hyperknot closed 5 years ago
So I couldn't figure out what to downgrade, conda didn't even allow me to use geopandas == 0.5.0
, even though it was the previous version I was using.
So I had downgraded to a few month old docker baseimage, which of course works perfectly.
Here are the details from that image, maybe that helps.
Environment (conda list
):
Details about conda
and system ( conda info
):
Your image mixes packages from defaults
, pypi
and conda-forge
. It is virtually impossible for us to debug that. If you can re-create an environment using strict
channel and conda-forge
on top of defaults
we can probably help.
Closing this b/c we cannot debug it.
Those are unrelated packages, mostly for web development. But case in point, here is a minimal reproducible Dockerfile:
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y wget
RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
/opt/conda/bin/conda update conda -y && \
/opt/conda/bin/conda config --add channels conda-forge && \
/opt/conda/bin/conda config --set channel_priority strict && \
/opt/conda/bin/conda install \
geopandas numexpr bottleneck
RUN /opt/conda/bin/python -c 'import fiona'
In https://github.com/pyproj4/pyproj/issues/415#issuecomment-525979663, @snowman2 figured out that the reason for this is that global environment works differently from local. I don't know why is this the case, I was always using global environment in Docker images and I'd like to continue doing that.
So if I have run conda create -n env geopandas numexpr bottleneck
the import errors, and I believe the segfaults are not present.
I've created a super minimal repro case:
Dockerfile
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y wget
RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
/opt/conda/bin/conda update conda -y && \
/opt/conda/bin/conda config --add channels conda-forge && \
/opt/conda/bin/conda config --set channel_priority strict
RUN /opt/conda/bin/conda install \
geopandas numexpr bottleneck
RUN /opt/conda/bin/python -c 'import fiona'
RUN /opt/conda/bin/python -c 'import pyproj; pyproj.show_versions()'
ADD test.py .
RUN /opt/conda/bin/python -X faulthandler test.py
test.py
import geopandas
import pandas as pd
from shapely.geometry import Point
d = {'lat': [48], 'lon': [17]}
df = pd.DataFrame(data=d)
df['Coordinates'] = list(zip(df.lon, df.lat))
df['Coordinates'] = df['Coordinates'].apply(Point)
gdf = geopandas.GeoDataFrame(df, geometry='Coordinates', crs={'init': 'epsg:4326'})
gdf = gdf.to_crs('+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')
The output is:
Step 5/8 : RUN /opt/conda/bin/python -c 'import fiona'
---> Running in 5244dc7a9907
proj_create: Open of /opt/conda/share/proj failed
proj_create: init=epsg:/init=IGNF: syntax not supported in non-PROJ4 emulation mode
proj_create: Open of /opt/conda/share/proj failed
proj_create: init=epsg:/init=IGNF: syntax not supported in non-PROJ4 emulation mode
Removing intermediate container 5244dc7a9907
---> fbb3cea55d37
Step 6/8 : RUN /opt/conda/bin/python -c 'import pyproj; pyproj.show_versions()'
---> Running in e08c7e848abf
System:
python: 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 21:52:21) [GCC 7.3.0]
executable: /opt/conda/bin/python
machine: Linux-4.15.0-1037-gcp-x86_64-with-debian-stretch-sid
PROJ:
PROJ: 6.1.1
data dir: /opt/conda/share/proj
Python deps:
pyproj: 2.3.0
pip: 19.2.3
setuptools: 41.2.0
Cython: None
Removing intermediate container e08c7e848abf
---> cde69b9050bc
Step 7/8 : ADD test.py .
---> 910f70195298
Step 8/8 : RUN /opt/conda/bin/python test.py
---> Running in febd45a3ac0a
proj_create: Open of /opt/conda/share/proj failed
proj_create: init=epsg:/init=IGNF: syntax not supported in non-PROJ4 emulation mode
proj_create: Open of /opt/conda/share/proj failed
proj_create: init=epsg:/init=IGNF: syntax not supported in non-PROJ4 emulation mode
Fatal Python error: Segmentation fault
Current thread 0x00007fa8eb545700 (most recent call first):
File "/opt/conda/lib/python3.7/site-packages/pyproj/crs.py", line 303 in __init__
File "/opt/conda/lib/python3.7/site-packages/pyproj/crs.py", line 434 in from_user_input
File "/opt/conda/lib/python3.7/site-packages/pyproj/proj.py", line 145 in __init__
File "/opt/conda/lib/python3.7/site-packages/geopandas/geoseries.py", line 304 in to_crs
File "/opt/conda/lib/python3.7/site-packages/geopandas/geodataframe.py", line 459 in to_crs
File "test.py", line 13 in <module>
Segmentation fault (core dumped)
The command '/bin/sh -c /opt/conda/bin/python -X faulthandler test.py' returned a non-zero code: 139
Updated ^^^ with python -X faulthandler
I believe I've reached the core of the problem in https://github.com/pyproj4/pyproj/issues/415.
I can conclude there are exactly two bugs here:
PROJ_LIB=/opt/conda/share/proj
, both Fiona and Pyproj works like before.pip uninstall
and pip install
pyproj, so that it's installed from pip instead of Conda then it works perfectly without PROJ_LIB. Same for fiona.So Conda install of pyproj and fiona are broken and pip install works.
RUN /opt/conda/bin/pip uninstall -y pyproj
RUN /opt/conda/bin/pip install pyproj
RUN /opt/conda/bin/pip uninstall -y fiona
RUN /opt/conda/bin/pip install fiona
There is a problem with PROJ_LIB variable in newer Conda install. That effect Fiona, etc. as well.
What problem? It works fine when I create an environment and activate it as conda is designed to work.
Yes, but it breaks with the global install. In a docker environment it's common to use global install, as there is no bash environment to speak of.
On 2019. Aug 29., Thu at 17:46, Filipe notifications@github.com wrote:
There is a problem with PROJ_LIB variable in newer Conda install. That effect Fiona, etc. as well.
What problem? It works fine when I create an environment and activate it as conda is designed to work.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/conda-forge/geopandas-feedstock/issues/63?email_source=notifications&email_token=AADYVDYLEBBDYQTYTXI2VWLQG7VNJA5CNFSM4IRV53K2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5O6DCQ#issuecomment-526246282, or mute the thread https://github.com/notifications/unsubscribe-auth/AADYVD5ZYBRBLMHQ3SQSGMLQG7VNJANCNFSM4IRV53KQ .
Yes, but it breaks with the global install. In a docker environment it's common to use global install, as there is no bash environment to speak of.
That is a misuse of the conda
design. It is not a problem with the package. You can configure the base
env though. You should do something like conda init
and then conda activate base
. I'm locking this issue b/c it is not related to geopandas
or conda-forge
packages. It is a conda
on docker questions.
Issue:
I've just recreated a Docker image which had the following lines to install geopandas in a clean Ubuntu 16.04 system. This has been working perfectly for a year before yesterday.
However, as of yesterday, everything is broken.
First, I get lots of warning lines of the one below:
I've opened this issue in https://github.com/conda-forge/pyproj-feedstock/issues/47 however I've just been directed over to Fiona, so I've opened one there as well: https://github.com/conda-forge/fiona-feedstock/issues/137
However the big problem is actually not these warning lines, but that geopandas / pyproj actually seg faults. I've opened this issue for it: https://github.com/pyproj4/pyproj/issues/415
Now, I was able to downgrade pyproj to 2.2.2 using
conda install 'pyproj < 2.3'
. This gave me a better version of the segmentation fault, which is a nice Python exception with a warning message at the bottom (detailed in the pyproj issue).So I believe the core is with the geopandas conda install, and the intertwined Python modules. To say it shortly, it's broken as it is now, on Ubuntu at least.
Replicating is very simple, you can simply run the afore mentioned command in a Docker image and it'll replicate it 100%. The seg fault I cannot replicate, as it only happens with some input files.
I'm looking for ways to make this work, but I don't even know where to start. What packages should I downgrade?
Environment (
conda list
):Details about
conda
and system (conda info
):