conda-forge / pyspice-feedstock

A conda-smithy repository for pyspice.
BSD 3-Clause "New" or "Revised" License
1 stars 5 forks source link

Add windows #5

Closed stuarteberg closed 4 years ago

stuarteberg commented 4 years ago

Checklist

conda-forge-linter commented 4 years ago

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

FabriceSalvaire commented 4 years ago

will look asap ...

I just pushed code to download Windows DLL, don't know if we can do that automatically ???

stuarteberg commented 4 years ago

Sorry, this isn’t quite ready yet. I need to fix the script that sets the version. I won’t be able to fix it until two hours from now.

Regarding the dll, that shouldn’t be necessary for conda users. Conda will download the ngspice package as a dependency.

stuarteberg commented 4 years ago

@FabriceSalvaire

This is very close to working.

  1. All unit tests pass (a small patch was necessary...)
  2. ngspice-check-installation fails with the following error:
(%PREFIX%) %SRC_DIR%>ngspice-check-installation
Load PySpice module
loaded %PREFIX%\lib\site-packages\PySpice\__init__.py

NgSpiceShared configuration is
  NgSpiceShared.NGSPICE_PATH = %PREFIX%\lib\site-packages\PySpice\Spice\NgSpice\Spice64_dll
  NgSpiceShared.LIBRARY_PATH = %PREFIX%\lib\site-packages\PySpice\Spice\NgSpice\Spice64_dll\dll-vs\ngspice{}.dll

OS is Windows
Found in library search path: None

Load NgSpiceShared
2020-05-26 19:46:21,446 - PySpice.Spice.NgSpice.Shared.NgSpiceShared - Shared.WARNING - locale LC_NUMERIC is not forced to C
Load library %PREFIX%\lib\site-packages\PySpice\Spice\NgSpice\Spice64_dll\dll-vs\ngspice.dll
Traceback (most recent call last):
  File "D:\bld\pyspice_1590521967497\_test_env\Scripts\ngspice-check-installation-script.py", line 83, in <module>
    ngspice = NgSpiceShared(verbose=True)
  File "D:\bld\pyspice_1590521967497\_test_env\lib\site-packages\PySpice\Spice\NgSpice\Shared.py", line 395, in __init__
    self._load_library(verbose)
  File "D:\bld\pyspice_1590521967497\_test_env\lib\site-packages\PySpice\Spice\NgSpice\Shared.py", line 441, in _load_library
    self._ngspice_shared = ffi.dlopen(self.library_path)
  File "D:\bld\pyspice_1590521967497\_test_env\lib\site-packages\cffi\api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "D:\bld\pyspice_1590521967497\_test_env\lib\site-packages\cffi\api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File "D:\bld\pyspice_1590521967497\_test_env\lib\site-packages\cffi\api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: cannot load library 'D:\bld\pyspice_1590521967497\_test_env\lib\site-packages\PySpice\Spice\NgSpice\Spice64_dll\dll-vs\ngspice.dll': error 0x7e.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'D:\bld\pyspice_1590521967497\_test_env\lib\site-packages\PySpice\Spice\NgSpice\Spice64_dll\dll-vs\ngspice.dll'

How do I tell PySpice that the dll is actually located in {sys.prefix}\bin\ngspice.dll? Or am I required to copy it into PySpice\Spice\NgSpice\Spice64_dll\dll-vs\ngspice.dll?

stuarteberg commented 4 years ago

@FabriceSalvaire This works now (including ngspice-check-installation) on all three platforms. After I merge this PR, Windows users can install ngspice and PySpice in exactly the same way as Mac and Linux users:

conda create -n spice -c conda-forge pyspice
conda activate spice

BTW, to get this working, I had to write two small patches. I submitted them as PRs to your repo:

stuarteberg commented 4 years ago

@FabriceSalvaire BTW, I resolved the error above by creating a symlink that places ngspice.dll in the place that PySpice expects to see it. It seems to work, at least enough to satisfy ngspice-check-installation.