question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression in 1.3.1 due to #407 when scripts and notebooks are in a separate folder.

See original GitHub issue

The directory structure looks like this:

├── ./notebooks
│   ├── ./notebooks/01_tabular_data_exploration.ipynb
├── ./python_scripts
│   ├── ./python_scripts/01_tabular_data_exploration.py

I am running jupytext like this:

jupytext --set-formats python_scripts//py:percent,notebooks//ipynb python_scripts/01_tabular_data_exploration.py

Output:

[jupytext] Reading python_scripts/01_tabular_data_exploration.py
[jupytext] Updating notebook metadata with '{"jupytext": {"formats": "python_scripts//py:percent,notebooks//ipynb"}}'
Traceback (most recent call last):
  File "/home/lesteve/miniconda3/envs/scikit-learn-tutorial/bin/jupytext", line 10, in <module>
    sys.exit(jupytext())
  File "/home/lesteve/miniconda3/envs/scikit-learn-tutorial/lib/python3.7/site-packages/jupytext/cli.py", line 271, in jupytext
    exit_code += jupytext_single_file(nb_file, args, log)
  File "/home/lesteve/miniconda3/envs/scikit-learn-tutorial/lib/python3.7/site-packages/jupytext/cli.py", line 464, in jupytext_single_file
    for alt_path, alt_fmt in paired_paths(nb_file, fmt, formats)[::-1]:
  File "/home/lesteve/miniconda3/envs/scikit-learn-tutorial/lib/python3.7/site-packages/jupytext/paired_paths.py", line 126, in paired_paths
    short_form_multiple_formats(formats)))
jupytext.paired_paths.InconsistentPath: Paired paths 'python_scripts/python_scripts/01_tabular_data_exploration.py','python_scripts/notebooks/01_tabular_data_exploration.ipynb' do not include the current notebook path 'python_scripts/01_tabular_data_exploration.py'. Current format is 'py:percent', and paired formats are 'python_scripts//py:percent,notebooks//ipynb'.

If I try to change the format to avoid the error then jupytext --sync does not seem to create the notebook in the right place. Maybe I was doing something fishy all along in which case I would appreciate advice how to use jupytext better …

Here is a way to reproduce:

pip install jupytext==1.3.1
cd /tmp && git clone https://github.com/lesteve/scikit-learn-tutorial && cd scikit-learn-tutorial
jupytext --set-formats python_scripts//py:percent,notebooks//ipynb python_scripts/01_tabular_data_exploration.py

Same thing works fine with jupytext 1.3:

pip install jupytext==1.3
cd /tmp && git clone https://github.com/lesteve/scikit-learn-tutorial && cd scikit-learn-tutorial
jupytext --set-formats python_scripts//py:percent,notebooks//ipynb python_scripts/01_tabular_data_exploration.py

git bisecting points to #407.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lestevecommented, Mar 9, 2020

Great thanks a lot for this! I just tested with 1.3.5 and it does fix the issue.

0reactions
lestevecommented, Mar 9, 2020

I don’t know much about Makefile unfortunately, but yours look nice!

I don’t know much either about Makefiles and just to be explicit, nobody should use my Makefile because it is horrible and it does not really work!

OK if I end up doing something not too hacky, I will let you know. My feeling is that it will be very hacky though, at least the first iteration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert notebook code into Python scripts - Azure
In this tutorial, you learn how to convert Jupyter notebooks into Python scripts to make it testing and automation friendly using the ...
Read more >
SigmaPlot 12.5 User's Guide
The SigmaPlot documentation set is comprised of three separate books and Help files, organized by how features appear in SigmaPlot's ribbons.
Read more >
OpenModelica User's Guide
The long-term research related goals and issues of the OpenModelica open source ... This subsystem provides a lightweight notebook editor, compared.
Read more >
Dive into Deep Learning
407. 11.2 Convexity . ... However, due to the rapid development of deep learning, ... 1.3.1. Fig. 1.3.1: Supervised learning. Regression.
Read more >
Your First Machine Learning Project in Python Step-By-Step
Let's test 6 different algorithms: Logistic Regression (LR); Linear Discriminant Analysis (LDA); K-Nearest Neighbors (KNN). Classification and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found