cx_freeze exe file works in anaconda prompt but not in windows cmd command prompt?
I have spent most of the day trying to compile an exe file from my python script and running it through the vanilla cmd command prompt. I finally managed to create the exe-file, but weirdly it only runs in the anaconda prompt and not in the cmd.
Here is the full error message/traceback:
Traceback (most recent call last):
File "C:ProgramDataAnaconda3libsite-packagescx_Freezeinitscripts__startup__.py", line 14, in run
module.run()
File "C:ProgramDataAnaconda3libsite-packagescx_FreezeinitscriptsConsole.py", line 26, in run
exec(code, m.__dict__)
File "generateKonsekvens.py", line 1, in <module>
File "C:ProgramDataAnaconda3libsite-packagesgeopandas__init__.py", line 1, in <module>
from geopandas.geoseries import GeoSeries
File "C:ProgramDataAnaconda3libsite-packagesgeopandasgeoseries.py", line 7, in <module>
from shapely.geometry import shape, Point
File "C:ProgramDataAnaconda3libsite-packagesshapelygeometry__init__.py", line 4, in <module>
from .base import CAP_STYLE, JOIN_STYLE
File "C:ProgramDataAnaconda3libsite-packagesshapelygeometrybase.py", line 17, in <module>
from shapely.coords import CoordinateSequence
File "C:ProgramDataAnaconda3libsite-packagesshapelycoords.py", line 8, in <module>
from shapely.geos import lgeos
File "C:ProgramDataAnaconda3libsite-packagesshapelygeos.py", line 130, in <module>
os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"),
File "C:ProgramDataAnaconda3libsite-packagesshapelygeos.py", line 56, in load_dll
libname, fallbacks or ))
OSError: Could not find lib geos_c.dll or load any of its variants ['Library\lib\geos_c.dll'].
As you can see, it seems to be loking for something in the anaconda folder - which defeats the purpose of freezing the script. The geos_c.dll file belongs to fiona/shapely, which are in this case dependencies of the geopandas module. The geos_c.dll file can be found in the compiled folder (lib/shapely).
The script runs just fine in the normal command prompt using
python generateKonsekvens.py
in the folder.
What is causing this, and how do I fix it?
Python 3.6.3, windows 10 64 bit.
UPDATE
I tried the suggestions of jpeg, and none of them worked (could not find the dll at those locations). I tried an adhoc-solution of manually copying the dll to Library/lib/geos_c.dll
, which copied some files over, but gives the same error. I then tried with build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "bin", "geos_c.dll"), os.path.join("Library", "bin", "geos_c.dll"))]}
, which finds the geos_c.dll
file in the anaconda directory. I also packaged it through the windows cmd this time, and the dlls are included. The error, however, remains the same... I will now try with a new, fresh conda anaconda venv, but any other ideas are welcome in the meanwhile.
python anaconda cx-freeze geopandas geos
add a comment |
I have spent most of the day trying to compile an exe file from my python script and running it through the vanilla cmd command prompt. I finally managed to create the exe-file, but weirdly it only runs in the anaconda prompt and not in the cmd.
Here is the full error message/traceback:
Traceback (most recent call last):
File "C:ProgramDataAnaconda3libsite-packagescx_Freezeinitscripts__startup__.py", line 14, in run
module.run()
File "C:ProgramDataAnaconda3libsite-packagescx_FreezeinitscriptsConsole.py", line 26, in run
exec(code, m.__dict__)
File "generateKonsekvens.py", line 1, in <module>
File "C:ProgramDataAnaconda3libsite-packagesgeopandas__init__.py", line 1, in <module>
from geopandas.geoseries import GeoSeries
File "C:ProgramDataAnaconda3libsite-packagesgeopandasgeoseries.py", line 7, in <module>
from shapely.geometry import shape, Point
File "C:ProgramDataAnaconda3libsite-packagesshapelygeometry__init__.py", line 4, in <module>
from .base import CAP_STYLE, JOIN_STYLE
File "C:ProgramDataAnaconda3libsite-packagesshapelygeometrybase.py", line 17, in <module>
from shapely.coords import CoordinateSequence
File "C:ProgramDataAnaconda3libsite-packagesshapelycoords.py", line 8, in <module>
from shapely.geos import lgeos
File "C:ProgramDataAnaconda3libsite-packagesshapelygeos.py", line 130, in <module>
os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"),
File "C:ProgramDataAnaconda3libsite-packagesshapelygeos.py", line 56, in load_dll
libname, fallbacks or ))
OSError: Could not find lib geos_c.dll or load any of its variants ['Library\lib\geos_c.dll'].
As you can see, it seems to be loking for something in the anaconda folder - which defeats the purpose of freezing the script. The geos_c.dll file belongs to fiona/shapely, which are in this case dependencies of the geopandas module. The geos_c.dll file can be found in the compiled folder (lib/shapely).
The script runs just fine in the normal command prompt using
python generateKonsekvens.py
in the folder.
What is causing this, and how do I fix it?
Python 3.6.3, windows 10 64 bit.
UPDATE
I tried the suggestions of jpeg, and none of them worked (could not find the dll at those locations). I tried an adhoc-solution of manually copying the dll to Library/lib/geos_c.dll
, which copied some files over, but gives the same error. I then tried with build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "bin", "geos_c.dll"), os.path.join("Library", "bin", "geos_c.dll"))]}
, which finds the geos_c.dll
file in the anaconda directory. I also packaged it through the windows cmd this time, and the dlls are included. The error, however, remains the same... I will now try with a new, fresh conda anaconda venv, but any other ideas are welcome in the meanwhile.
python anaconda cx-freeze geopandas geos
According to the error message you posted it should belib
, notbin
(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll")
notos.path.join(sys.prefix, "Library", "bin", "geos_c.dll")
) or do I misunderstand something?
– jpeg
Nov 16 '18 at 9:22
Exactly - thats what I thought. But the dll-file is in fact located in thebin
-folder, not in thelib
-folder in my anaconda directory. There is a file in thelib
-folder calledgeos_c.lib
, which may be relevant?
– dingobar
Nov 16 '18 at 9:38
Interesting. It looks like the way Anaconda packages the dependencies is not straightforward... If this is an option for you, you could also make a new Python installation not using Anaconda and installshapely
there usingpip
, my expectation is thatcx_Freeze
would work correctly in this new installation. Or maybe there is a way to tellgeos
where to find the DLL using an environment variable as for TCL for example, but I don't know that.
– jpeg
Nov 16 '18 at 9:44
It seems to be an issue between Anaconda andcx_Freeze
affecting several packages, see the post by Henfri at the end of this cx_Freeze issue. You could also try this with the wheel corresponding to your configuration.
– jpeg
Nov 16 '18 at 10:01
add a comment |
I have spent most of the day trying to compile an exe file from my python script and running it through the vanilla cmd command prompt. I finally managed to create the exe-file, but weirdly it only runs in the anaconda prompt and not in the cmd.
Here is the full error message/traceback:
Traceback (most recent call last):
File "C:ProgramDataAnaconda3libsite-packagescx_Freezeinitscripts__startup__.py", line 14, in run
module.run()
File "C:ProgramDataAnaconda3libsite-packagescx_FreezeinitscriptsConsole.py", line 26, in run
exec(code, m.__dict__)
File "generateKonsekvens.py", line 1, in <module>
File "C:ProgramDataAnaconda3libsite-packagesgeopandas__init__.py", line 1, in <module>
from geopandas.geoseries import GeoSeries
File "C:ProgramDataAnaconda3libsite-packagesgeopandasgeoseries.py", line 7, in <module>
from shapely.geometry import shape, Point
File "C:ProgramDataAnaconda3libsite-packagesshapelygeometry__init__.py", line 4, in <module>
from .base import CAP_STYLE, JOIN_STYLE
File "C:ProgramDataAnaconda3libsite-packagesshapelygeometrybase.py", line 17, in <module>
from shapely.coords import CoordinateSequence
File "C:ProgramDataAnaconda3libsite-packagesshapelycoords.py", line 8, in <module>
from shapely.geos import lgeos
File "C:ProgramDataAnaconda3libsite-packagesshapelygeos.py", line 130, in <module>
os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"),
File "C:ProgramDataAnaconda3libsite-packagesshapelygeos.py", line 56, in load_dll
libname, fallbacks or ))
OSError: Could not find lib geos_c.dll or load any of its variants ['Library\lib\geos_c.dll'].
As you can see, it seems to be loking for something in the anaconda folder - which defeats the purpose of freezing the script. The geos_c.dll file belongs to fiona/shapely, which are in this case dependencies of the geopandas module. The geos_c.dll file can be found in the compiled folder (lib/shapely).
The script runs just fine in the normal command prompt using
python generateKonsekvens.py
in the folder.
What is causing this, and how do I fix it?
Python 3.6.3, windows 10 64 bit.
UPDATE
I tried the suggestions of jpeg, and none of them worked (could not find the dll at those locations). I tried an adhoc-solution of manually copying the dll to Library/lib/geos_c.dll
, which copied some files over, but gives the same error. I then tried with build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "bin", "geos_c.dll"), os.path.join("Library", "bin", "geos_c.dll"))]}
, which finds the geos_c.dll
file in the anaconda directory. I also packaged it through the windows cmd this time, and the dlls are included. The error, however, remains the same... I will now try with a new, fresh conda anaconda venv, but any other ideas are welcome in the meanwhile.
python anaconda cx-freeze geopandas geos
I have spent most of the day trying to compile an exe file from my python script and running it through the vanilla cmd command prompt. I finally managed to create the exe-file, but weirdly it only runs in the anaconda prompt and not in the cmd.
Here is the full error message/traceback:
Traceback (most recent call last):
File "C:ProgramDataAnaconda3libsite-packagescx_Freezeinitscripts__startup__.py", line 14, in run
module.run()
File "C:ProgramDataAnaconda3libsite-packagescx_FreezeinitscriptsConsole.py", line 26, in run
exec(code, m.__dict__)
File "generateKonsekvens.py", line 1, in <module>
File "C:ProgramDataAnaconda3libsite-packagesgeopandas__init__.py", line 1, in <module>
from geopandas.geoseries import GeoSeries
File "C:ProgramDataAnaconda3libsite-packagesgeopandasgeoseries.py", line 7, in <module>
from shapely.geometry import shape, Point
File "C:ProgramDataAnaconda3libsite-packagesshapelygeometry__init__.py", line 4, in <module>
from .base import CAP_STYLE, JOIN_STYLE
File "C:ProgramDataAnaconda3libsite-packagesshapelygeometrybase.py", line 17, in <module>
from shapely.coords import CoordinateSequence
File "C:ProgramDataAnaconda3libsite-packagesshapelycoords.py", line 8, in <module>
from shapely.geos import lgeos
File "C:ProgramDataAnaconda3libsite-packagesshapelygeos.py", line 130, in <module>
os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"),
File "C:ProgramDataAnaconda3libsite-packagesshapelygeos.py", line 56, in load_dll
libname, fallbacks or ))
OSError: Could not find lib geos_c.dll or load any of its variants ['Library\lib\geos_c.dll'].
As you can see, it seems to be loking for something in the anaconda folder - which defeats the purpose of freezing the script. The geos_c.dll file belongs to fiona/shapely, which are in this case dependencies of the geopandas module. The geos_c.dll file can be found in the compiled folder (lib/shapely).
The script runs just fine in the normal command prompt using
python generateKonsekvens.py
in the folder.
What is causing this, and how do I fix it?
Python 3.6.3, windows 10 64 bit.
UPDATE
I tried the suggestions of jpeg, and none of them worked (could not find the dll at those locations). I tried an adhoc-solution of manually copying the dll to Library/lib/geos_c.dll
, which copied some files over, but gives the same error. I then tried with build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "bin", "geos_c.dll"), os.path.join("Library", "bin", "geos_c.dll"))]}
, which finds the geos_c.dll
file in the anaconda directory. I also packaged it through the windows cmd this time, and the dlls are included. The error, however, remains the same... I will now try with a new, fresh conda anaconda venv, but any other ideas are welcome in the meanwhile.
python anaconda cx-freeze geopandas geos
python anaconda cx-freeze geopandas geos
edited Nov 16 '18 at 9:15
dingobar
asked Nov 15 '18 at 16:18
dingobardingobar
13
13
According to the error message you posted it should belib
, notbin
(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll")
notos.path.join(sys.prefix, "Library", "bin", "geos_c.dll")
) or do I misunderstand something?
– jpeg
Nov 16 '18 at 9:22
Exactly - thats what I thought. But the dll-file is in fact located in thebin
-folder, not in thelib
-folder in my anaconda directory. There is a file in thelib
-folder calledgeos_c.lib
, which may be relevant?
– dingobar
Nov 16 '18 at 9:38
Interesting. It looks like the way Anaconda packages the dependencies is not straightforward... If this is an option for you, you could also make a new Python installation not using Anaconda and installshapely
there usingpip
, my expectation is thatcx_Freeze
would work correctly in this new installation. Or maybe there is a way to tellgeos
where to find the DLL using an environment variable as for TCL for example, but I don't know that.
– jpeg
Nov 16 '18 at 9:44
It seems to be an issue between Anaconda andcx_Freeze
affecting several packages, see the post by Henfri at the end of this cx_Freeze issue. You could also try this with the wheel corresponding to your configuration.
– jpeg
Nov 16 '18 at 10:01
add a comment |
According to the error message you posted it should belib
, notbin
(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll")
notos.path.join(sys.prefix, "Library", "bin", "geos_c.dll")
) or do I misunderstand something?
– jpeg
Nov 16 '18 at 9:22
Exactly - thats what I thought. But the dll-file is in fact located in thebin
-folder, not in thelib
-folder in my anaconda directory. There is a file in thelib
-folder calledgeos_c.lib
, which may be relevant?
– dingobar
Nov 16 '18 at 9:38
Interesting. It looks like the way Anaconda packages the dependencies is not straightforward... If this is an option for you, you could also make a new Python installation not using Anaconda and installshapely
there usingpip
, my expectation is thatcx_Freeze
would work correctly in this new installation. Or maybe there is a way to tellgeos
where to find the DLL using an environment variable as for TCL for example, but I don't know that.
– jpeg
Nov 16 '18 at 9:44
It seems to be an issue between Anaconda andcx_Freeze
affecting several packages, see the post by Henfri at the end of this cx_Freeze issue. You could also try this with the wheel corresponding to your configuration.
– jpeg
Nov 16 '18 at 10:01
According to the error message you posted it should be
lib
, not bin
(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll")
not os.path.join(sys.prefix, "Library", "bin", "geos_c.dll")
) or do I misunderstand something?– jpeg
Nov 16 '18 at 9:22
According to the error message you posted it should be
lib
, not bin
(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll")
not os.path.join(sys.prefix, "Library", "bin", "geos_c.dll")
) or do I misunderstand something?– jpeg
Nov 16 '18 at 9:22
Exactly - thats what I thought. But the dll-file is in fact located in the
bin
-folder, not in the lib
-folder in my anaconda directory. There is a file in the lib
-folder called geos_c.lib
, which may be relevant?– dingobar
Nov 16 '18 at 9:38
Exactly - thats what I thought. But the dll-file is in fact located in the
bin
-folder, not in the lib
-folder in my anaconda directory. There is a file in the lib
-folder called geos_c.lib
, which may be relevant?– dingobar
Nov 16 '18 at 9:38
Interesting. It looks like the way Anaconda packages the dependencies is not straightforward... If this is an option for you, you could also make a new Python installation not using Anaconda and install
shapely
there using pip
, my expectation is that cx_Freeze
would work correctly in this new installation. Or maybe there is a way to tell geos
where to find the DLL using an environment variable as for TCL for example, but I don't know that.– jpeg
Nov 16 '18 at 9:44
Interesting. It looks like the way Anaconda packages the dependencies is not straightforward... If this is an option for you, you could also make a new Python installation not using Anaconda and install
shapely
there using pip
, my expectation is that cx_Freeze
would work correctly in this new installation. Or maybe there is a way to tell geos
where to find the DLL using an environment variable as for TCL for example, but I don't know that.– jpeg
Nov 16 '18 at 9:44
It seems to be an issue between Anaconda and
cx_Freeze
affecting several packages, see the post by Henfri at the end of this cx_Freeze issue. You could also try this with the wheel corresponding to your configuration.– jpeg
Nov 16 '18 at 10:01
It seems to be an issue between Anaconda and
cx_Freeze
affecting several packages, see the post by Henfri at the end of this cx_Freeze issue. You could also try this with the wheel corresponding to your configuration.– jpeg
Nov 16 '18 at 10:01
add a comment |
2 Answers
2
active
oldest
votes
I suspect you're missing something in your build options. Without knowing the exact package I can't tell you what to include, but an example of the build options would be this (a win32 application for adding virtual printers, hence the win32 stuff)
build_exe_options = {"packages": ["os","numpy","idna",'win32com.gen_py',"win32timezone","win32print"],
"excludes": ["tkinter"],
"includes":}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
#if sys.platform == "win32":
# base = "Win32GUI"
setup( name = "VirtualPrinter",
version = "0.1",
description = "KRF AMS VPrint",
options = {"build_exe": build_exe_options},
executables = [Executable(r"krfprinter.py", base=base)])
Thanks for the answer. So, in the "packages" entry, I would just include some of the packages that I think the compiler might be missing?
– dingobar
Nov 15 '18 at 19:03
Yes that is correct
– krflol
Nov 15 '18 at 19:04
add a comment |
The problem is probably due to the fact that the executable is looking for Library/lib/geos_c.dll
(due to the way Anaconda packages shapely
) but the DLLs gets packaged by cx_Freeze
into lib/shapely/geos_c.dll
(probably as it would be if shapely
would have been installed using pip
). When you run your executable from the Anaconda prompt, the fallback finds the DLL in the Anaconda library path, but if you rum from cmd, this fallback does not work as no copy of the DLL is found in the cmd path.
Try to manually include the DLL in the installation directory, the fallback will probably work then. You can do this using the build_exe
option include_files
in your setup script:
import os
import sys
build_exe_options = {'include_files': [os.path.join(sys.prefix, "Library", "lib", "geos_c.dll")]}
...
setup(...
options = {'build_exe': build_exe_options},
...)
If this does not work, try with
build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"), os.path.join("lib", "geos_c.dll"))]}
If this also does not work, try with
build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"), os.path.join("Library", "lib", "geos_c.dll"))]}
I tried the above, and have updated the question with the results. Not solved yet unfortunately.
– dingobar
Nov 16 '18 at 8:58
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323685%2fcx-freeze-exe-file-works-in-anaconda-prompt-but-not-in-windows-cmd-command-promp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I suspect you're missing something in your build options. Without knowing the exact package I can't tell you what to include, but an example of the build options would be this (a win32 application for adding virtual printers, hence the win32 stuff)
build_exe_options = {"packages": ["os","numpy","idna",'win32com.gen_py',"win32timezone","win32print"],
"excludes": ["tkinter"],
"includes":}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
#if sys.platform == "win32":
# base = "Win32GUI"
setup( name = "VirtualPrinter",
version = "0.1",
description = "KRF AMS VPrint",
options = {"build_exe": build_exe_options},
executables = [Executable(r"krfprinter.py", base=base)])
Thanks for the answer. So, in the "packages" entry, I would just include some of the packages that I think the compiler might be missing?
– dingobar
Nov 15 '18 at 19:03
Yes that is correct
– krflol
Nov 15 '18 at 19:04
add a comment |
I suspect you're missing something in your build options. Without knowing the exact package I can't tell you what to include, but an example of the build options would be this (a win32 application for adding virtual printers, hence the win32 stuff)
build_exe_options = {"packages": ["os","numpy","idna",'win32com.gen_py',"win32timezone","win32print"],
"excludes": ["tkinter"],
"includes":}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
#if sys.platform == "win32":
# base = "Win32GUI"
setup( name = "VirtualPrinter",
version = "0.1",
description = "KRF AMS VPrint",
options = {"build_exe": build_exe_options},
executables = [Executable(r"krfprinter.py", base=base)])
Thanks for the answer. So, in the "packages" entry, I would just include some of the packages that I think the compiler might be missing?
– dingobar
Nov 15 '18 at 19:03
Yes that is correct
– krflol
Nov 15 '18 at 19:04
add a comment |
I suspect you're missing something in your build options. Without knowing the exact package I can't tell you what to include, but an example of the build options would be this (a win32 application for adding virtual printers, hence the win32 stuff)
build_exe_options = {"packages": ["os","numpy","idna",'win32com.gen_py',"win32timezone","win32print"],
"excludes": ["tkinter"],
"includes":}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
#if sys.platform == "win32":
# base = "Win32GUI"
setup( name = "VirtualPrinter",
version = "0.1",
description = "KRF AMS VPrint",
options = {"build_exe": build_exe_options},
executables = [Executable(r"krfprinter.py", base=base)])
I suspect you're missing something in your build options. Without knowing the exact package I can't tell you what to include, but an example of the build options would be this (a win32 application for adding virtual printers, hence the win32 stuff)
build_exe_options = {"packages": ["os","numpy","idna",'win32com.gen_py',"win32timezone","win32print"],
"excludes": ["tkinter"],
"includes":}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
#if sys.platform == "win32":
# base = "Win32GUI"
setup( name = "VirtualPrinter",
version = "0.1",
description = "KRF AMS VPrint",
options = {"build_exe": build_exe_options},
executables = [Executable(r"krfprinter.py", base=base)])
answered Nov 15 '18 at 16:25
krflolkrflol
53728
53728
Thanks for the answer. So, in the "packages" entry, I would just include some of the packages that I think the compiler might be missing?
– dingobar
Nov 15 '18 at 19:03
Yes that is correct
– krflol
Nov 15 '18 at 19:04
add a comment |
Thanks for the answer. So, in the "packages" entry, I would just include some of the packages that I think the compiler might be missing?
– dingobar
Nov 15 '18 at 19:03
Yes that is correct
– krflol
Nov 15 '18 at 19:04
Thanks for the answer. So, in the "packages" entry, I would just include some of the packages that I think the compiler might be missing?
– dingobar
Nov 15 '18 at 19:03
Thanks for the answer. So, in the "packages" entry, I would just include some of the packages that I think the compiler might be missing?
– dingobar
Nov 15 '18 at 19:03
Yes that is correct
– krflol
Nov 15 '18 at 19:04
Yes that is correct
– krflol
Nov 15 '18 at 19:04
add a comment |
The problem is probably due to the fact that the executable is looking for Library/lib/geos_c.dll
(due to the way Anaconda packages shapely
) but the DLLs gets packaged by cx_Freeze
into lib/shapely/geos_c.dll
(probably as it would be if shapely
would have been installed using pip
). When you run your executable from the Anaconda prompt, the fallback finds the DLL in the Anaconda library path, but if you rum from cmd, this fallback does not work as no copy of the DLL is found in the cmd path.
Try to manually include the DLL in the installation directory, the fallback will probably work then. You can do this using the build_exe
option include_files
in your setup script:
import os
import sys
build_exe_options = {'include_files': [os.path.join(sys.prefix, "Library", "lib", "geos_c.dll")]}
...
setup(...
options = {'build_exe': build_exe_options},
...)
If this does not work, try with
build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"), os.path.join("lib", "geos_c.dll"))]}
If this also does not work, try with
build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"), os.path.join("Library", "lib", "geos_c.dll"))]}
I tried the above, and have updated the question with the results. Not solved yet unfortunately.
– dingobar
Nov 16 '18 at 8:58
add a comment |
The problem is probably due to the fact that the executable is looking for Library/lib/geos_c.dll
(due to the way Anaconda packages shapely
) but the DLLs gets packaged by cx_Freeze
into lib/shapely/geos_c.dll
(probably as it would be if shapely
would have been installed using pip
). When you run your executable from the Anaconda prompt, the fallback finds the DLL in the Anaconda library path, but if you rum from cmd, this fallback does not work as no copy of the DLL is found in the cmd path.
Try to manually include the DLL in the installation directory, the fallback will probably work then. You can do this using the build_exe
option include_files
in your setup script:
import os
import sys
build_exe_options = {'include_files': [os.path.join(sys.prefix, "Library", "lib", "geos_c.dll")]}
...
setup(...
options = {'build_exe': build_exe_options},
...)
If this does not work, try with
build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"), os.path.join("lib", "geos_c.dll"))]}
If this also does not work, try with
build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"), os.path.join("Library", "lib", "geos_c.dll"))]}
I tried the above, and have updated the question with the results. Not solved yet unfortunately.
– dingobar
Nov 16 '18 at 8:58
add a comment |
The problem is probably due to the fact that the executable is looking for Library/lib/geos_c.dll
(due to the way Anaconda packages shapely
) but the DLLs gets packaged by cx_Freeze
into lib/shapely/geos_c.dll
(probably as it would be if shapely
would have been installed using pip
). When you run your executable from the Anaconda prompt, the fallback finds the DLL in the Anaconda library path, but if you rum from cmd, this fallback does not work as no copy of the DLL is found in the cmd path.
Try to manually include the DLL in the installation directory, the fallback will probably work then. You can do this using the build_exe
option include_files
in your setup script:
import os
import sys
build_exe_options = {'include_files': [os.path.join(sys.prefix, "Library", "lib", "geos_c.dll")]}
...
setup(...
options = {'build_exe': build_exe_options},
...)
If this does not work, try with
build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"), os.path.join("lib", "geos_c.dll"))]}
If this also does not work, try with
build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"), os.path.join("Library", "lib", "geos_c.dll"))]}
The problem is probably due to the fact that the executable is looking for Library/lib/geos_c.dll
(due to the way Anaconda packages shapely
) but the DLLs gets packaged by cx_Freeze
into lib/shapely/geos_c.dll
(probably as it would be if shapely
would have been installed using pip
). When you run your executable from the Anaconda prompt, the fallback finds the DLL in the Anaconda library path, but if you rum from cmd, this fallback does not work as no copy of the DLL is found in the cmd path.
Try to manually include the DLL in the installation directory, the fallback will probably work then. You can do this using the build_exe
option include_files
in your setup script:
import os
import sys
build_exe_options = {'include_files': [os.path.join(sys.prefix, "Library", "lib", "geos_c.dll")]}
...
setup(...
options = {'build_exe': build_exe_options},
...)
If this does not work, try with
build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"), os.path.join("lib", "geos_c.dll"))]}
If this also does not work, try with
build_exe_options = {'include_files': [(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"), os.path.join("Library", "lib", "geos_c.dll"))]}
answered Nov 16 '18 at 8:19
jpegjpeg
1,0042919
1,0042919
I tried the above, and have updated the question with the results. Not solved yet unfortunately.
– dingobar
Nov 16 '18 at 8:58
add a comment |
I tried the above, and have updated the question with the results. Not solved yet unfortunately.
– dingobar
Nov 16 '18 at 8:58
I tried the above, and have updated the question with the results. Not solved yet unfortunately.
– dingobar
Nov 16 '18 at 8:58
I tried the above, and have updated the question with the results. Not solved yet unfortunately.
– dingobar
Nov 16 '18 at 8:58
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323685%2fcx-freeze-exe-file-works-in-anaconda-prompt-but-not-in-windows-cmd-command-promp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
According to the error message you posted it should be
lib
, notbin
(os.path.join(sys.prefix, "Library", "lib", "geos_c.dll")
notos.path.join(sys.prefix, "Library", "bin", "geos_c.dll")
) or do I misunderstand something?– jpeg
Nov 16 '18 at 9:22
Exactly - thats what I thought. But the dll-file is in fact located in the
bin
-folder, not in thelib
-folder in my anaconda directory. There is a file in thelib
-folder calledgeos_c.lib
, which may be relevant?– dingobar
Nov 16 '18 at 9:38
Interesting. It looks like the way Anaconda packages the dependencies is not straightforward... If this is an option for you, you could also make a new Python installation not using Anaconda and install
shapely
there usingpip
, my expectation is thatcx_Freeze
would work correctly in this new installation. Or maybe there is a way to tellgeos
where to find the DLL using an environment variable as for TCL for example, but I don't know that.– jpeg
Nov 16 '18 at 9:44
It seems to be an issue between Anaconda and
cx_Freeze
affecting several packages, see the post by Henfri at the end of this cx_Freeze issue. You could also try this with the wheel corresponding to your configuration.– jpeg
Nov 16 '18 at 10:01