Skip to content

Commit

Permalink
copernicus-sdm on vm
Browse files Browse the repository at this point in the history
  • Loading branch information
bbest committed Mar 23, 2024
1 parent c33019b commit 69d7e98
Show file tree
Hide file tree
Showing 2 changed files with 195 additions and 0 deletions.
50 changes: 50 additions & 0 deletions copernicus-sdm.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"cells": [
{
"cell_type": "raw",
"metadata": {},
"source": [
"---\n",
"title: \"copernicus-sdm\"\n",
"editor: visual\n",
"---"
],
"id": "34e84f05"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Goals\n",
"\n",
"- Extract Copernicus env by month\n",
"\n",
"- Predict at historical and future monthly / annual time steps to show change\n",
"\n",
"## Fetch\n"
],
"id": "11d045cf"
},
{
"cell_type": "code",
"metadata": {},
"source": [
"import sys\n",
"import platform\n",
"print sys.version"
],
"id": "b7db6874",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
145 changes: 145 additions & 0 deletions copernicus-sdm.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
title: "copernicus-sdm"
editor: visual
---

## Goals

- Extract Copernicus env by month

- Predict at historical and future monthly / annual time steps to show change

## Fetch

```{python}
import sys
import platform
print(sys.path)
print(sys.version)
```

Python 3.8.10

\* \[Copernicus Marine Toolbox - Installation \| Copernicus Marine Help Center\](https://help.marine.copernicus.eu/en/articles/7970514-copernicus-marine-toolbox-installation)

> **For now,** **the Copernicus Marine Toolbox works only with a version of Python \>=3.9, \<3.13.**
After initial render:

ModuleNotFoundError: No module named 'nbformat'
Python 3 installation:
Version: 3.8.10
Path: /opt/venv/r-reticulate/bin/python3
Jupyter: (None)

Jupyter is not available in this Python installation.
Install with python3 -m pip install jupyter

[notice] A new release of pip is available: 23.2.1 -> 24.0
[notice] To update, run: python3 -m pip install --upgrade pip

```{bash}
#| eval: false
/opt/venv/r-reticulate/bin/python3 -m pip install jupyter
```

[notice] A new release of pip is available: 23.2.1 -> 24.0

[notice] To update, run: python3 -m pip install --upgrade pip

```{bash}
#| eval: false
/opt/venv/r-reticulate/bin/python3 -m pip install --upgrade pip
/opt/venv/r-reticulate/bin/python3 --version
```

Python 3.8.10

```{r}
#| eval: false
librarian::shelf(reticulate)
install_python(version = "3.12:latest", list = FALSE, force = FALSE)
```

trying URL 'https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer'
Content type 'text/plain; charset=utf-8' length 2827 bytes
==================================================
downloaded 2827 bytes

Installing pyenv ...
Cloning into '/home/admin/.local/share/r-reticulate/pyenv'...
Cloning into '/home/admin/.local/share/r-reticulate/pyenv/plugins/pyenv-doctor'...
Cloning into '/home/admin/.local/share/r-reticulate/pyenv/plugins/pyenv-update'...
Cloning into '/home/admin/.local/share/r-reticulate/pyenv/plugins/pyenv-virtualenv'...

WARNING: seems you still have not added 'pyenv' to the load path.

# Load pyenv automatically by appending
# the following to
# ~/.bash_profile if it exists, otherwise ~/.profile (for login shells)
# and ~/.bashrc (for interactive shells) :

export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

# Restart your shell for the changes to take effect.

# Load pyenv-virtualenv automatically by adding
# the following to ~/.bashrc:

eval "$(pyenv virtualenv-init -)"

Done! pyenv has been installed to '/home/admin/.local/share/r-reticulate/pyenv/bin/pyenv'.
Cloning into '/home/admin/.pyenv/plugins/pyenv-update'...
+ /home/admin/.local/share/r-reticulate/pyenv/bin/pyenv update
+ /home/admin/.local/share/r-reticulate/pyenv/bin/pyenv install --skip-existing 3.12.2
Downloading Python-3.12.2.tar.xz...
-> https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tar.xz
Installing Python-3.12.2...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/admin/.pyenv/versions/3.12.2/lib/python3.12/curses/__init__.py", line 13, in <module>
from _curses import *
ModuleNotFoundError: No module named '_curses'
WARNING: The Python curses extension was not compiled. Missing the ncurses lib?
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'readline'
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Installed Python-3.12.2 to /home/admin/.pyenv/versions/3.12.2
[1] "/home/admin/.pyenv/versions/3.12.2/bin/python3.12"

Added to `~/.profile` and `~/.bashrc`:

# R reticulate::install_python(version = "3.12:latest", list = FALSE, force = FALSE)
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

```{}
```

Python interpreter

- `/home/admin/.pyenv/versions/3.12.2`FAILS

- `/usr/bin/python3.12`WORKS

'/usr/bin/python3.12' '/usr/local/lib/R/site-library/reticulate/config/config.py'

Traceback (most recent call last):

File "/usr/local/lib/R/site-library/reticulate/config/config.py", line 16, in <module>

import imp

ModuleNotFoundError: No module named 'imp'

docker run --hostname=6f2e649c9608 --env=PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env=LANG=C.UTF-8 --env=GPG_KEY=7169605F62C751356D054A26A821E680E5FA6305 --env=PYTHON_VERSION=3.12.2 --env=PYTHON_PIP_VERSION=24.0 --env=PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/dbf0c85f76fb6e1ab42aa672ffca6f0a675d9ee4/public/get-pip.py --env=PYTHON_GET_PIP_SHA256=dfe9fd5c28dc98b5ac17979a953ea550cec37ae1b47a5116007395bfacff2ab9 --volume=/Users/bbest:/home/bbest --runtime=runc -d copernicusmarine/copernicusmarine:1.0.5

docker run --hostname=6f2e649c9608 --env=PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env=LANG=C.UTF-8 --env=GPG_KEY=7169605F62C751356D054A26A821E680E5FA6305 --env=PYTHON_VERSION=3.12.2 --env=PYTHON_PIP_VERSION=24.0 --env=PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/dbf0c85f76fb6e1ab42aa672ffca6f0a675d9ee4/public/get-pip.py --env=PYTHON_GET_PIP_SHA256=dfe9fd5c28dc98b5ac17979a953ea550cec37ae1b47a5116007395bfacff2ab9 --volume=/Users/bbest:/bbest --runtime=runc -d copernicusmarine/copernicusmarine:1.0.5

docker run -d -it --volume=/Users/bbest:/bbest copernicusmarine/copernicusmarine:1.0.5 /bin/bash

0 comments on commit 69d7e98

Please sign in to comment.