Skip to content

OSError: cannot load library 'libngspice.so' #117

@tamenol

Description

@tamenol

Environment (OS, Python version, PySpice version, simulator)

Linux Ubuntu 16.04
Python 3.5
PySpice 1.1.4

Expected Behaviour

Running

import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()

from PySpice.Spice.NgSpice.Shared import NgSpiceShared

ngspice = NgSpiceShared.new_instance()

print(ngspice.exec_command('version -f'))
print(ngspice.exec_command('print all'))
print(ngspice.exec_command('devhelp resistor'))

without erros.

Actual Behaviour

(venv) speklap:thesis_pcb$ python -i run.py

2018-06-01 15:02:01,206 - PySpice.Spice.NgSpice.Shared.NgSpiceShared.new_instance - INFO - New instance for id 0
Traceback (most recent call last):
File "run.py", line 6, in
ngspice = NgSpiceShared.new_instance()
File "/home/speklap/Projects/InProgress/thesis_pcb/venv/lib/python3.5/site-packages/PySpice/Spice/NgSpice/Shared.py", line 338, in new_instance
instance = cls(ngspice_id=ngspice_id, send_data=send_data)
File "/home/speklap/Projects/InProgress/thesis_pcb/venv/lib/python3.5/site-packages/PySpice/Spice/NgSpice/Shared.py", line 356, in init
self._load_library()
File "/home/speklap/Projects/InProgress/thesis_pcb/venv/lib/python3.5/site-packages/PySpice/Spice/NgSpice/Shared.py", line 381, in _load_library
self._ngspice_shared = ffi.dlopen(library_path)
File "/home/speklap/Projects/InProgress/thesis_pcb/venv/lib/python3.5/site-packages/cffi/api.py", line 141, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "/home/speklap/Projects/InProgress/thesis_pcb/venv/lib/python3.5/site-packages/cffi/api.py", line 802, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File "/home/speklap/Projects/InProgress/thesis_pcb/venv/lib/python3.5/site-packages/cffi/api.py", line 797, in _load_backend_lib
raise OSError(msg)
OSError: cannot load library 'libngspice.so': libngspice.so: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libngspice.so'

Steps to reproduce the behaviour

I've install pyspice using pip in a virtual environment. ngspice I tried installing through apt-get and through tarball. I can open the ngspice 'console' and use it to simulate but can't use it with python.

I can't locate libngspice.so on my system, also my $LD_LIBRARY_PATH shows up empty.

How can I fix this? Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions