Well, I stand corrected. From Norwid's answer, it seems it may be possible to 
change environment during execution.

Still, remember that this is the opposite of the idea of having environments! 
The whole idea of conda environments to have a contained space with all you 
need. If you need to change environment during runtime,  it just means that 
your environment is missing something...

--
Gustavo Seabra

________________________________
From: Jeff Saxon <jmsstarli...@gmail.com>
Sent: Wednesday, December 2, 2020 9:29:37 AM
To: Gustavo Seabra <gustavo.sea...@gmail.com>; 
rdkit-discuss@lists.sourceforge.net <rdkit-discuss@lists.sourceforge.net>
Subject: Re: [Rdkit-discuss] activate my-rdkit-env from python script

Right, many thanks!
Yes, each time, before I run any script using python with the conda
that I used to install RDKIT, I have to source the proper environment
directly to bash, after which everything works correctly..
btw, why #subprocess.run('conda activate my-rdkit-env', shell=True)
did not work? I thought it would be the same as the aforementioned
step, but it asks me

To initialize your shell, run


    $ conda init <SHELL_NAME>


Currently supported shells are:

  - bash

  - fish

  - tcsh

  - xonsh

  - zsh

  - powershell

ср, 2 дек. 2020 г. в 14:25, Gustavo Seabra <gustavo.sea...@gmail.com>:
>
> I don't believe that it is possible. You have to run your script from within 
> the environment where you installed rdkit.
>
> What I actually do is to have a work environment,  and then install all the 
> packages I need in this same env.
>
> --
> Gustavo Seabra
>
> ________________________________
> From: Jeff Saxon <jmsstarli...@gmail.com>
> Sent: Wednesday, December 2, 2020 6:48:47 AM
> To: rdkit-discuss@lists.sourceforge.net <rdkit-discuss@lists.sourceforge.net>
> Subject: [Rdkit-discuss] activate my-rdkit-env from python script
>
> Dear All,
>
> Since I installed RDKIT using conda, I have to use the following
> command from my bash terminal to activate the RDKIT environment:
> conda activate my-rdkit-env
> How can I do the same but inside my python script?
> I have already tried to call subprocess, but it did not work
> # source environment from python script;
> subprocess.run('conda init bash', shell=True)
> subprocess.run('conda activate my-rdkit-env', shell=True)
>
>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to