Closed cboulay closed 5 years ago
seems ceres dll has everything it needs as ctypes can load it: https://github.com/conda-forge/ceres-solver-feedstock/pull/4
Admittedly I don't use ctypes very much, but I seem to have a different result. I think your test environment in #4 installs some other components that I don't get with a simple conda environment. (I don't know what the -host
section is doing in the meta.yaml file but maybe this is concealing the problem).
conda create -n ceres_test python=3.6 ceres-solver -c conda-forge
The following NEW packages will be INSTALLED:
blas pkgs/main/win-64::blas-1.0-mkl
ceres-solver conda-forge/win-64::ceres-solver-1.14.0-h42bd5c8_2
certifi conda-forge/win-64::certifi-2019.3.9-py36_0
eigen conda-forge/win-64::eigen-3.3.7-he980bc4_1000
gflags conda-forge/win-64::gflags-2.2.2-he025d50_1001
glog pkgs/main/win-64::glog-0.3.5-h6538335_1
intel-openmp pkgs/main/win-64::intel-openmp-2019.3-203
libblas conda-forge/win-64::libblas-3.8.0-8_mkl
libcblas conda-forge/win-64::libcblas-3.8.0-8_mkl
liblapack conda-forge/win-64::liblapack-3.8.0-8_mkl
metis conda-forge/win-64::metis-5.1.0-h6538335_1003
mkl pkgs/main/win-64::mkl-2019.3-203
pip conda-forge/win-64::pip-19.1.1-py36_0
python conda-forge/win-64::python-3.6.7-he025d50_1004
setuptools conda-forge/win-64::setuptools-41.0.1-py36_0
suitesparse pkgs/main/win-64::suitesparse-5.2.0-hdce8814_0
tbb conda-forge/win-64::tbb-2019.6-he980bc4_0
vc pkgs/main/win-64::vc-14.1-h0510ff6_4
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.15.26706-h3a45250_4
wheel conda-forge/win-64::wheel-0.33.2-py36_0
wincertstore conda-forge/win-64::wincertstore-0.2-py36_1002
conda activate ceres_test
python
import ctypes, os
dll_path = os.path.join(os.environ['CONDA_PREFIX'],'Library','bin','ceres.dll')
print("dll {} found".format(dll_path) if os.path.isfile(dll_path) else "dll not found")
ctypes.cdll[dll_path]
(ceres_test) C:\Users\Chad>python
Python 3.6.7 (default, Feb 28 2019, 07:28:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes, os
>>> dll_path = os.path.join(os.environ['CONDA_PREFIX'],'Library','bin','ceres.dll')
>>> print("dll {} found".format(dll_path) if os.path.isfile(dll_path) else "dll not found")
dll C:\Users\Chad\.conda\envs\ceres_test\Library\bin\ceres.dll found
>>> ctypes.cdll[dll_path]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Chad\.conda\envs\ceres_test\lib\ctypes\__init__.py", line 423, in __getitem__
return getattr(self, name)
File "C:\Users\Chad\.conda\envs\ceres_test\lib\ctypes\__init__.py", line 418, in __getattr__
dll = self._dlltype(name)
File "C:\Users\Chad\.conda\envs\ceres_test\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
If you run DependenciesGUI from the Anaconda Prompt then it has the same PATH and it can help diagnose python's unhelpful OSError
:
D:\Tools\Misc\Dependencies\DependenciesGUI.exe C:\Users\Chad\.conda\envs\ceres_test\Library\bin\ceres.dll
There are 4 dlls that cannot be found on the path, and indeed are not anywhere on my system.
glog comes from defaults, this is unsupported : conda-forge must be the top-priority channel
I get the same packages when conda-forge is my top-priority channel. On the conda-forge glog site here, there is no Windows entry.
(base) C:\Users\Chad>conda config --show channels
channels:
- conda-forge
- defaults
(ceres_test) C:\Users\Chad>conda install -c conda-forge glog
Collecting package metadata: done
Solving environment: done
## Package Plan ##
environment location: C:\Users\Chad\.conda\envs\ceres_test
added / updated specs:
- glog
The following NEW packages will be INSTALLED:
gflags conda-forge/win-64::gflags-2.2.2-he025d50_1001
glog pkgs/main/win-64::glog-0.3.5-h6538335_1
oh, so glog shouldnt be pulled from ceres then
Before you go too far down this rabbit hole, I'd like to emphasize that I have glog.dll on my path, and it isn't missing any dependencies. The missing dlls are spqr, cholmod, openblas, and cxsparse, and these are dependencies of ceres.dll, not of glog.dll.
oh yes so it must be suitesparse then
can you try the new revision of the package ?
My conda command is still picking up the old one. I've never been on the bleeding edge of a conda release before. Can you please point me to instructions on how to use the new revision?
maybe conda update --all
?
It works! Thank you so much!
hi . i've installed ceres pkg in python too. how do i continue from there. are there any examples of how to use it in python? i mean, what lib should i import... ?
I also have the same problem on how to import ceres-solver after installation. No matter how I try, I still can't find the way to import this module. Is there anyone who knows how to use this library properly? Many thanks.
maybe try with a clean installation from miniconda (and conda-forge as top priority channel)
Issue:
It's great to finally have ceres-solver in conda!
I did
conda install ceres-solver
.Using dependencies.exe, I see that the installed ceres.dll depends on many dlls, 4 of which are not included when installing ceres-solver: spqr.dll, cholmod.dll, openblas.dll, and cxsparse.dll.
There are static .bin files available for each of these (from suitesparse, I believe), but that's no help to ceres.dll.
Environment (
conda list
):Details about
conda
and system (conda info
):