<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Javier,</p>
    <p>I've come across some other bugs that are specific to Conda
      running in Pycharm only this morning. Up to and including getting
      different projection strings back for the exact same file,
      depending on whether the `GetProjectionRef` is called via Pycharm
      or the terminal (using the exact same conda environment).</p>
    <p>`osr.SpatialReference().ImportFromEPSG(4326)` returns a
      RuntimeError in Pycharm but works in the terminal:</p>
    <p>PROJ: proj_create_from_database: Open of
      /some/path/anaconda3/envs/abc/share/proj failed</p>
    <p>So there's something weird going on with environment's that's
      Posix specific.<br>
    </p>
    <p>Thanks,<br>
      Jonathan<br>
    </p>
    <div class="moz-cite-prefix">On 2023-10-12 09:10, Javier Jimenez
      Shaw wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CADRrdKsHk4yOxVEbuu1nPhGeBB0QUhgkgd8c3UOd8jRUjKMjyQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">
        <div>Are you running pycharm under the conda environment? If you
          lose any setting while combining both it can be a problem.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Have you tried setting PROJ_DEBUG=3 ?</div>
        <div dir="auto">It will show some traces from PROJ, like the
          location of proj.db used. The point is if you can see the std
          out.<br>
          <br>
          <div class="gmail_quote" dir="auto">
            <div dir="ltr" class="gmail_attr">On Wed, 11 Oct 2023, 15:18
              Jonathan Moules via gdal-dev, <<a
                href="mailto:gdal-dev@lists.osgeo.org"
                moz-do-not-send="true" class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi List,<br>
              <br>
              So, after more investigation:<br>
              <br>
              * Using Python Anaconda on either Mac or Linux for GDAL
              (3.7.1), <br>
              `GetSpatialRef` triggers a RunTime Error for all
              shapefiles (but only <br>
              shapefiles).<br>
              <br>
              * This happens on Ubuntu (two machines), and a Mac, but
              only under PyCharm.<br>
              <br>
              * Using the exact same `conda` environment as triggers the
              above: <br>
              running it directly from the terminal works fine.<br>
              <br>
              So there's something about the combination of conda and
              Pycharm that <br>
              breaks this aspect of GDAL shapefile handling on *nix and
              Mac.<br>
              <br>
              Any thoughts? Also, who do I actually report this bug to?
              Is it GDAL, <br>
              Conda, Pycharm, something else?<br>
              <br>
              Cheers,<br>
              <br>
              Jonathan<br>
              <br>
              <br>
              On 2023-09-28 14:58, Jonathan Moules via gdal-dev wrote:<br>
              > Well, it seems that PROJ_DATA isn't set in their
              environment. But it's <br>
              > not set in mine either
              (`print(os.environ['PROJ_DATA']`)! So no idea <br>
              > why mine works just fine without it (Windows 11
              thing?).<br>
              ><br>
              > Creating a PROJ_DATA env var didn't fix anything.
              Even adding it <br>
              > explicitly in Python.<br>
              ><br>
              > Their log file does have this in at a WARNING level:<br>
              ><br>
              > `PROJ: proj_create_from_database: Open of <br>
              > /home/user/anaconda3/envs/env1/share/proj failed`<br>
              ><br>
              > That path has: `drwxrwxr-x` permissions.<br>
              ><br>
              > To answer Even's earlier question:<br>
              ><br>
              > `ogrinfo /path/to/shape.shp` works fine on their
              system.<br>
              ><br>
              ><br>
              ><br>
              > On 2023-09-28 12:37, Rahkonen Jukka wrote:<br>
              >> Hi,<br>
              >><br>
              >> Then they should add that environment if they do
              not know that they <br>
              >> do not belong to "most users" <br>
              >> <a
                href="https://proj.org/en/9.3/usage/environmentvars.html"
                rel="noreferrer noreferrer" target="_blank"
                moz-do-not-send="true" class="moz-txt-link-freetext">https://proj.org/en/9.3/usage/environmentvars.html</a><br>
              >><br>
              >> -Jukka Rahkonen-<br>
              >><br>
              >> -----Alkuperäinen viesti-----<br>
              >> Lähettäjä: gdal-dev <<a
                href="mailto:gdal-dev-bounces@lists.osgeo.org"
                target="_blank" rel="noreferrer" moz-do-not-send="true"
                class="moz-txt-link-freetext">gdal-dev-bounces@lists.osgeo.org</a>>
              Puolesta <br>
              >> Jonathan Moules via gdal-dev<br>
              >> Lähetetty: torstai 28. syyskuuta 2023 14.10<br>
              >> Vastaanottaja: <a
                href="mailto:gdal-dev@lists.osgeo.org" target="_blank"
                rel="noreferrer" moz-do-not-send="true"
                class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a>;
              Even Rouault <br>
              >> <<a href="mailto:even.rouault@spatialys.com"
                target="_blank" rel="noreferrer" moz-do-not-send="true"
                class="moz-txt-link-freetext">even.rouault@spatialys.com</a>><br>
              >> Aihe: Re: [gdal-dev] layer.GetSpatialRef() fails
              on linux for shapefiles<br>
              >><br>
              >> Hi Even,<br>
              >><br>
              >> The colleague doesn't have either a PROJ_LIB or a
              PROJ_DATA <br>
              >> environment variable.<br>
              >><br>
              >> I asked another colleague to try it; they're on
              Ubuntu 20.04, and it <br>
              >> worked for them. I believe using the same setup
              instructions.<br>
              >><br>
              >> Cheers,<br>
              >><br>
              >> Jonathan<br>
              >><br>
              >> On 2023-09-24 22:37, Jonathan Moules via gdal-dev
              wrote:<br>
              >>> Thanks Even. I don't have access to the
              machine either as the<br>
              >>> colleague is moving to another project. I'll
              have to see if it fails<br>
              >>> for another *nix user.<br>
              >>><br>
              >>> On 2023-09-24 22:35, Even Rouault wrote:<br>
              >>>> Le 24/09/2023 à 23:22, Jonathan Moules
              via gdal-dev a écrit :<br>
              >>>>>> Also check if the environment
              isn't messed up regarding PROJ and<br>
              >>>>> the PROJ_LIB/PROJ_DATA environment
              variable<br>
              >>>>><br>
              >>>>> Thanks Even; sorry, what does this
              line mean? I'm guessing you're<br>
              >>>>> referring to:<br>
              >>>>> <a
                href="https://proj.org/en/9.3/usage/environmentvars.html"
                rel="noreferrer noreferrer" target="_blank"
                moz-do-not-send="true" class="moz-txt-link-freetext">https://proj.org/en/9.3/usage/environmentvars.html</a>
              - what would a <br>
              >>>>> "messed up" one look like?<br>
              >>>>><br>
              >>>> Hard to say without access to the
              machine. Perhaps just try to<br>
              >>>> recreate a new Conda env from scratch<br>
              >>>><br>
              >>>><br>
              >>>
              _______________________________________________<br>
              >>> gdal-dev mailing list<br>
              >>> <a href="mailto:gdal-dev@lists.osgeo.org"
                target="_blank" rel="noreferrer" moz-do-not-send="true"
                class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
              >>> <a href="https://list/" rel="noreferrer
                noreferrer" target="_blank" moz-do-not-send="true"
                class="moz-txt-link-freetext">https://list/</a><br>
              >>> <a href="http://s.osgeo.org" rel="noreferrer
                noreferrer" target="_blank" moz-do-not-send="true">s.osgeo.org</a>%2Fmailman%2Flistinfo%2Fgdal-dev&data=05%7C01%7Cjukka.rahko<br>
              >>> nen%<a href="http://40maanmittauslaitos.fi"
                rel="noreferrer noreferrer" target="_blank"
                moz-do-not-send="true">40maanmittauslaitos.fi</a>%7C1f6517888cb34fa40aed08dbc01389dd%7Cc4f8a6<br>
              >>>
              3255804a1c92371d5a571b71fa%7C0%7C0%7C638314962370381350%7CUnknown%7CTW<br>
              >>>
              FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6<br>
              >>>
Mn0%3D%7C3000%7C%7C%7C&sdata=3fVru6K6Ndpkv35FnAbMOlT%2BM96USO7wywqx550<br>
              >>> uRUs%3D&reserved=0<br>
              >> _______________________________________________<br>
              >> gdal-dev mailing list<br>
              >> <a href="mailto:gdal-dev@lists.osgeo.org"
                target="_blank" rel="noreferrer" moz-do-not-send="true"
                class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
              >> <a
                href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
                rel="noreferrer noreferrer" target="_blank"
                moz-do-not-send="true" class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
              ><br>
              > _______________________________________________<br>
              > gdal-dev mailing list<br>
              > <a href="mailto:gdal-dev@lists.osgeo.org"
                target="_blank" rel="noreferrer" moz-do-not-send="true"
                class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
              > <a
                href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
                rel="noreferrer noreferrer" target="_blank"
                moz-do-not-send="true" class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
              _______________________________________________<br>
              gdal-dev mailing list<br>
              <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank"
                rel="noreferrer" moz-do-not-send="true"
                class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><br>
              <a
                href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
                rel="noreferrer noreferrer" target="_blank"
                moz-do-not-send="true" class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
            </blockquote>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>