Skip to content

Error when running from conda env python exe #11

@nahhhhhhhhhhhhhhhhhhhhh

Description

Hi,

I have anaconda installed and set up an environment with openbabel. It runs great when running from anaconda however i need to run through other software where i have to set the python interpreter "C:\ProgramData\Anaconda3\envs\python3-10-9\python.exe" and that's where the problems begin. How do i get it to open the environment as a conda environment or what do i have to set in my script to get it to work?

I need it for Spotfire data functions

from the python exe

Python 3.10.9 | packaged by conda-forge | (main, Feb  2 2023, 20:14:58) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from openbabel import pybel
>>> print(pybel.readstring("smi", "CN2C(=O)N(C)C(=O)C1=C2N=CN1C").write("can"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\envs\python3-10-9\lib\openbabel\pybel.py", line 200, in readstring
    raise ValueError("%s is not a recognised Open Babel format" % format)
ValueError: smi is not a recognised Open Babel format

How do i start python like this? keeping in mind i have to be able to set the path like this "C:\ProgramData\Anaconda3\envs\python3-10-9\python.exe"
what does anaconda run when we click "Run with Python"?

C:\Users\Administrator>conda.bat activate "C:\ProgramData\Anaconda3\envs\python3-10-9"

C:\Users\Administrator>set OLD_BABEL_DATADIR=C:\ProgramData\Anaconda3\envs\python3-10-9\share\openbabel

C:\Users\Administrator>set BABEL_DATADIR=C:\ProgramData\Anaconda3\envs\python3-10-9\share\openbabel
Python 3.10.9 | packaged by conda-forge | (main, Feb  2 2023, 20:14:58) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from openbabel import pybel
>>> print(pybel.readstring("smi", "CN2C(=O)N(C)C(=O)C1=C2N=CN1C").write("can"))
Cn1cnc2c1c(=O)n(C)c(=O)n2C

>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions