ngspyce icon indicating copy to clipboard operation
ngspyce copied to clipboard

Update documention for obtaining DLL

Open endolith opened this issue 6 years ago • 6 comments

I haven't used ngspyce in a while, but the latest two releases of ngspice have separate ngspice-28_64.zip and ngspice-28_dll_64.zip files, which contain executables and dll, respectively.

So the documentation I added in https://github.com/ignamv/ngspyce#getting-libngspice needs to be updated. I'm not sure where the recommended DLL installation path is now, and not sure how ngspyce should find the DLL, either.

PDF says "After compilation the executable, code models and initialization files are available in directory C: as C:\Spice, C:\Spice64 etc." but not the DLL

I know very little about Windows development, but maybe the DLL should be registered so that ngspyce can find it regardless of physical location? Is that how that works? Or maybe it should be included with ngspyce?

endolith avatar Jun 03 '18 14:06 endolith

Same problem, I have installed ngspice 37 using chocolatey and there is no dll anywhere in the program files. I also downloaded an auxiliary zip package named ngspice-37_dll_64 from the ngspice webpage, but I am currently getting an error if I try to import directly in command line (currently I know nothing about python, just getting started):

import ngspyce Traceback (most recent call last): File "", line 1, in File "C:\Python310\lib\site-packages\ngspyce-0.1-py3.10.egg\ngspyce_init_.py", line 2, in from .ngspyce import * File "C:\Python310\lib\site-packages\ngspyce-0.1-py3.10.egg\ngspyce\ngspyce.py", line 3, in from .sharedspice import * File "C:\Python310\lib\site-packages\ngspyce-0.1-py3.10.egg\ngspyce\sharedspice.py", line 37, in spice = CDLL('ngspice') File "C:\Python310\lib\ctypes_init_.py", line 374, in init self._handle = _dlopen(self._name, mode) FileNotFoundError: Could not find module 'ngspice' (or one of its dependencies). Try using the full path with constructor syntax.

I decided to try WSL/ubuntu on windows before giving this a second try.

adankvitschal avatar Jul 25 '22 18:07 adankvitschal

I don't have a Windows machine at hand, but have you tried adding the directory where the DLL is to sys.path?

sys.path.append('C:/path/to/DLL/directory')

ignamv avatar Jul 26 '22 05:07 ignamv

Sorry for the long time to answer. I tried that without success using some different folder combinations, the packages I found even had different DLL versions for vscode and mingw compiled versions, and it seems there exists a sepparate/obscure distribution for the windows versions of the shared versions of ngspice that is not the same as the executable version. Since I am now working on a Docker container without any problem, I will try this later.

adankvitschal avatar Aug 02 '22 14:08 adankvitschal

Is there any legal reason why the .dll can't be included in this software directly? I think that would simplify everything for everyone, and you don't have to worry about the interface becoming incompatible, etc.

endolith avatar Oct 21 '22 14:10 endolith

In principle we could do that, but it feels dirty to package ngspice:

  • users are going to be running our outdated ngspice unless we keep up with their releases.
  • binaries can hide all kinds of stuff. I wouldn't want to be spreading malware because someone's PC was compromised and compiled bad binaries.

If the ngspice team are already packaging the DLL, I think we should just make it easy to find this package and point Python to it. Unfortunately I can't try stuff myself since I'm only running Linux, but feel free to discuss this with the other Windows users.

ignamv avatar Oct 22 '22 16:10 ignamv

users are going to be running our outdated ngspice unless we keep up with their releases.

But isn't that good? The version of ngspice should match the version of ngspyce, so that they are guaranteed to be compatible with each other?

binaries can hide all kinds of stuff. I wouldn't want to be spreading malware because someone's PC was compromised and compiled bad binaries.

It's already getting those binaries from sourceforge and using them, what's the difference?

endolith avatar Oct 22 '22 19:10 endolith