Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Example of actions with dependencies using conda #47

Open
jchiquet opened this issue Oct 17, 2022 · 10 comments
Open

Example of actions with dependencies using conda #47

jchiquet opened this issue Oct 17, 2022 · 10 comments
Assignees

Comments

@jchiquet
Copy link

Hi,

I had trouble using miniconda (setup-miniconda@v2 + environment.yml) in conjunction with the quarto publishing action to add Python modules and dependencies. On the other hand, all this worked with setup-python@v4 and the use of pip and a requirements.txt file.
See workflow here (use of conda commented) https://github.com/computorg/published-paper-tsne/actions/runs/3257812600/workflow

Did I misconfigure something? Maybe I didn't activate the right environment? Adding an entry with (mini)conda among the usage examples with dependencies would be very helpful.

Thanks

@lwasser
Copy link

lwasser commented Feb 19, 2023

hey @jchiquet 👋 i'm running into a similar issue. it looks like you ended up just pip installing jupyter? but i would love to use my conda envt in my action. all works locally but not in an action. did you aver make any progress or receive help on this?

my workflow is here i run into Jupyter not found /nbformat not found errors when i build.

@jchiquet
Copy link
Author

jchiquet commented Feb 20, 2023

Hi!
I was using conda but in use, for simple Python projects, pip and venv proved to be easier to manage.

Nevertheless, here are two examples in the context of our journal using conda (with micromambda) and quarto with the Jupyter kernel.

Hopefully this helps!

At this point, I have not yet managed to use the "official" actions (quarto publish) with conda in an advanced way without there being small problems, so I am rendering "by hand/manually".

@cderv
Copy link
Collaborator

cderv commented Feb 20, 2023

Hello !

Thanks for the feedback on this.

does the quarto-actions/render works with the miniconda setup ? Is this only an issue with the publish action ?
do you have both a failed job log to share ?

Otherwise, I'll try to see if Quarto correctly find miniconda installation on GHA. Quarto is supposed to find conda env, but I never used it in GHA with conda so not sure how the conda environment is activated there.

Running quarto check in an intermediate step can probably help see if the correct python installation and environment is found

@lwasser
Copy link

lwasser commented Feb 21, 2023

hi @cderv you know i could NOT get this to work.

It looks like @jchiquet did get it to work but for me it always returned a "cant find jupyter" error . i got this error locally until i discovered QUARTO_ENV and set the environment there. but i didn't understand how these actions install into a conda envt. Below is what CI was returning

Starting python3 kernel...Traceback (most recent call last):
  File "/opt/quarto/share/jupyter/jupyter.py", line 21, in <module>
    from notebook import notebook_execute, RestartKernel
  File "/opt/quarto/share/jupyter/notebook.py", line 17, in <module>
    import nbformat
ModuleNotFoundError: No module named 'nbformat'
Python 3 installation:
  Version: 3.10.9 (Conda)
  Path: /opt/conda/bin/python
  Jupyter: (None)

Jupyter is not available in this Python installation.
Install with conda install jupyter

There is a environment.yml file in this directory. Is this for a conda env that you need to restore?

I ended up creating a docker container with mambaforge in it and installed quarto directly.
That's been working well and i think is a bit faster especially when i need to add more packages to my envt. But these actions were really hard for me to work with using conda and i suspect others will have similar issues. i found another quarto build that did a similar thing using docker with python.

@jchiquet
Copy link
Author

Hi @cderv , sorry it took me so long to answer.

Here is an example of micromamba setup which fails when using the quarto publish action, using the knitr kernel (fails with message 'Error in loadNamespace(x) : there is no package called ‘jsonlite’

https://github.com/computorg/computo-quarto-extension/actions/runs/4192833325/workflow

This work with direct call to quarto, like that:
https://github.com/computorg/computo-quarto-extension/actions/runs/4193154092/workflow

(
A bit unrelated but when using Julia + the Jupyter Kernel and julia-1.8, I add to explicitly install a system jupyter (via apt) so that the quarto rendering works:
https://github.com/computorg/template-computo-julia/blob/main/.github/workflows/build.yml
)

@lwasser
Copy link

lwasser commented Feb 23, 2023

it seems like there is a default envt that these actions assume you are using? especially if you have to use apt to install jupyter @jchiquet ?

@cderv cderv self-assigned this Mar 7, 2023
@cderv
Copy link
Collaborator

cderv commented Apr 4, 2023

@jchiquet @lwasser sorry for the delay on this one. It is long overdue. I am planning to dig into that.

Is this is an issue for you ?

@jchiquet
Copy link
Author

jchiquet commented Apr 5, 2023

Hi @cderv ,

I haven't used (mini)conda for some time... If I encounter any problems with recent versions of quarto or quarto actions, I will let you know. But everything works fine on my side for now.

@cderv
Copy link
Collaborator

cderv commented Apr 5, 2023

But everything works fine on my side for now.

Because you switch from Miniconda, right ? I'll set a test repo with conda to see how it goes.

@jchiquet
Copy link
Author

jchiquet commented Apr 5, 2023

Because you switch from Miniconda, right ?

For advanced examples with quarto + Python, yes...

I'll set a test repo with conda to see how it goes.

I'll be happy to give my feedback from past 'miniconda' experiences, if it can help

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants