ImportError: The 'CADET' namespace is currently an empty placeholder.

Expected behavior.

Hello, I’m really new in simulating and coding but i need cadet for simulating a chromatography column for my phd. I have some trouble during installation. I’ m trying to run the introduction example but something isn’t correct. Any help will be more that welcome.
i will provide you the code and the outcome from the terminal.

i did the installation as the instructions at A Guide to Reproducible Python Environments and CADET Installations and also via conda as the inactions at CADET-Core — CADET implies.

import sys
import os
import ctypes
from CADETProcess.processModel import ComponentSystem, Inlet, Outlet, LumpedRateModelWithoutPores, FlowSheet, Process
from CADETProcess.simulator import Cadet

# CADET path configuration (update with your local path)
CADET_PATH = r"C:\path_to_your_cadet_folder\cadet"
CADET_BIN_PATH = os.path.join(CADET_PATH, "bin")
CADET_DLL_PATH = os.path.join(CADET_BIN_PATH, "cadet.dll")

# Set environment variables for CADET
os.environ["CADET_PATH"] = CADET_BIN_PATH
os.environ["CADET_DLL_PATH"] = CADET_DLL_PATH
sys.path.append(CADET_BIN_PATH)

# Test loading the CADET DLL
try:
    cadet_dll = ctypes.WinDLL(CADET_DLL_PATH)  # Correct DLL path
    print("CADET DLL loaded successfully!")

    # Try accessing 'cadetGetLibraryVersion' explicitly to confirm it's available
    try:
        version_function = cadet_dll.cadetGetLibraryVersion  # Correct function name
        print("Function 'cadetGetLibraryVersion' loaded successfully.")
    except AttributeError:
        print("Function 'cadetGetLibraryVersion' not found in CADET DLL.")
except Exception as e:
    print(f"Failed to load CADET DLL: {e}")

# Step 3: Create a ComponentSystem with 1 chemical component.
component_system = ComponentSystem(1)

# Step 4: Create and configure Inlet
inlet = Inlet(component_system, "inlet")
inlet.c = 1  # mol / m^3
inlet.flow_rate = 1e-7
print("Inlet parameters:", inlet.parameters)

# Step 5: Create and configure Outlet
outlet = Outlet(component_system, "outlet")
print("Outlet parameters:", outlet.parameters)

# Step 6: Create a LumpedRateModelWithoutPores (column) and configure its properties
column = LumpedRateModelWithoutPores(component_system, "column")
column.required_parameters  # This can be omitted as it's not used directly
column.total_porosity = 0.4
column.diameter = 0.2
column.length = 0.1
column.axial_dispersion = 1e-7
print("Column parameters:", column.parameters)

# Step 7: Create a FlowSheet and add units (inlet, column, outlet)
flow_sheet = FlowSheet(component_system, "flow_sheet")
flow_sheet.add_unit(inlet)
flow_sheet.add_unit(outlet)
flow_sheet.add_unit(column)

flow_sheet.add_connection(inlet, column)
flow_sheet.add_connection(column, outlet)

# Step 8: Create and configure the process simulation
process = Process(flow_sheet, "process")
process.cycle_time = 20000
print("Process parameters:", process.parameters)

# Step 9: Initialize the simulator
simulator = Cadet(install_path=CADET_PATH)

# Step 10: Run the simulation
def run_simulation():
    try:
        simulator.check_cadet()
        simulation_results = simulator.simulate(process)
        print("Simulation completed successfully.")
        return simulation_results
    except Exception as e:
        print(f"Error during simulation: {e}")
        return None

simulation_results = run_simulation()

# Step 11: Plot the results
if simulation_results:
    try:
        simulation_results.solution.outlet.outlet.plot()
        print("Plotting results completed.")
    except AttributeError as e:
        print(f"Error while plotting results: {e}")

Actual behavior

Terminal outcome

C:\Users\Virginia\Documents\CodiBio\Python\CADET_project\venv\Scripts\python.exe C:\Users\Virginia\Documents\CodiBio\Python\CADET_project\Test.py 
Traceback (most recent call last):
  File "C:\Users\Virginia\Documents\CodiBio\Python\CADET_project\Test.py", line 8, in <module>
    from CADETProcess.processModel import ComponentSystem, Inlet, Outlet, LumpedRateModelWithoutPores, FlowSheet, Process
  File "C:\Users\Virginia\Documents\CodiBio\Python\CADET_project\venv\lib\site-packages\CADETProcess\__init__.py", line 36, in <module>
    from . import optimization
  File "C:\Users\Virginia\Documents\CodiBio\Python\CADET_project\venv\lib\site-packages\CADETProcess\optimization\__init__.py", line 100, in <module>
    from .results import *
  File "C:\Users\Virginia\Documents\CodiBio\Python\CADET_project\venv\lib\site-packages\CADETProcess\optimization\results.py", line 15, in <module>
    from cadet import H5
  File "C:\Users\Virginia\Documents\CodiBio\Python\CADET_project\venv\lib\site-packages\cadet\__init__.py", line 1, in <module>
    raise ImportError(
ImportError: The 'CADET' namespace is currently an empty placeholder.


For information on how to install 'CADET', see: https://cadet.github.io/

- CADET-Core is distributed via conda-forge: https://anaconda.org/conda-forge/cadet
- CADET-Python is distributed via PyPI: https://pypi.org/project/CADET-Python/


Process finished with exit code 1

How to produce bug (including a minimal reproducible example)

The code is from the cadet tutorial. It is the first code

File produced by conda env export > environment.yml

environment.yml (314 Bytes)

Hello virginia and welcome to the Forum.

The error message is from the cadet package on PyPi that can be installed with pip install cadet. This is a legacy package, that we will at some point in the future re-activate to distribute CADET-Core via PyPI but for not it’s an empty placeholder. Usually, that package should not end up installed on your system. Instead, as indicated in the error message, CADET-Core should be installed from conda-forge and CADET-Python should be installed from PyPi. If you have cadet installed via pip, please uninstall it with pip uninstall cadet. Then try your code again. If that still does not work, please let us know.

Best wishes,
Ron