PySpice-org / PySpice

Simulate electronic circuit using Python and the Ngspice / Xyce simulators
https://pyspice.fabrice-salvaire.fr
GNU General Public License v3.0
660 stars 173 forks source link

Installation problem #195

Open Ricky-PV opened 4 years ago

Ricky-PV commented 4 years ago

I've been trying to get pyspice up and running without success. Is anyone able to spot the issue?

Environment (OS = Windows 10, Python version = 3.6 , PySpice version = 1.3.2, simulator = ngspice)

Expected Behaviour

Run a simple SPICE simulation

Actual Behaviour

Following error is returned: runfile('C:/everything/Spice_simulations/20200422-full-model/untitled0.py', wdir='C:/everything/Spice_simulations/20200422-full-model') C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\PySpice\Logging\Logging.py:47: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. logging_config = yaml.load(open(logging_config_file_name, 'r')) Traceback (most recent call last):

File "", line 1, in runfile('C:/everything/Spice_simulations/20200422-full-model/untitled0.py', wdir='C:/everything/Spice_simulations/20200422-full-model')

File "C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile execfile(filename, namespace)

File "C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/everything/Spice_simulations/20200422-full-model/untitled0.py", line 27, in simulator = circuit.simulator(temperature=25, nominal_temperature=25)

File "C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\PySpice\Spice\Netlist.py", line 1281, in simulator return CircuitSimulator.factory(self, *args, **kwargs)

File "C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\PySpice\Spice\Simulation.py", line 708, in factory return sub_cls(circuit, *args, **kwargs)

File "C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\PySpice\Spice\NgSpice\Simulation.py", line 99, in init self._ngspice_shared = NgSpiceShared.new_instance()

File "C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\PySpice\Spice\NgSpice\Shared.py", line 331, in new_instance instance = cls(ngspice_id=ngspice_id, send_data=send_data)

File "C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\PySpice\Spice\NgSpice\Shared.py", line 349, in init self._load_library()

File "C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\PySpice\Spice\NgSpice\Shared.py", line 375, in _load_library self._ngspice_shared = ffi.dlopen(library_path)

File "C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\cffi\api.py", line 150, in dlopen lib, function_cache = _make_ffi_library(self, name, flags)

File "C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\cffi\api.py", line 832, in _make_ffi_library backendlib = _load_backend_lib(backend, libname, flags)

File "C:\Users\username\AppData\Local\Continuum\anaconda3\envs\pvmismatch-env\lib\site-packages\cffi\api.py", line 827, in _load_backend_lib raise OSError(msg)

OSError: cannot load library 'C:\Program Files\Spice64_dll\dll-vs\ngspice.dll': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'C:\Program Files\Spice64_dll\dll-vs\ngspice.dll'

Steps to reproduce the behaviour

The installation instructions were followed. ngspice v 30 was downloaded and unzipped in the specified directory. Windows explorer shows that the file does exist with the following path: C:\Program Files\Spice64-dll\dll-vs\ngspice.dll

Code: `import matplotlib.pyplot as plt #################################################################################################### import PySpice.Logging.Logging as Logging logger = Logging.setup_logging() #################################################################################################### from PySpice.Doc.ExampleTools import find_libraries from PySpice.Probe.Plot import plot from PySpice.Spice.Library import SpiceLibrary from PySpice.Spice.Netlist import Circuit from PySpice.Unit import * #################################################################################################### from PySpice.Spice.NgSpice.Shared import NgSpiceShared #################################################################################################### libraries_path = find_libraries() spice_library = SpiceLibrary(libraries_path)

circuit = Circuit('test')

r1 = circuit.R('1', 1, 0, 10) simulator = circuit.simulator(temperature=25, nominal_temperature=25)`

FabriceSalvaire commented 4 years ago

did not manage to locate a library called 'C:\Program Files\Spice64_dll\dll-vs\ngspice.dll'

typo _ and not -

C:\Program Files\Spice64-dll\dll-vs\ngspice.dll