Giter Club home page Giter Club logo

Comments (10)

mereldawu avatar mereldawu commented on July 23, 2024 2

I realised instead of using nbstripout directly, I can just use python -m nbstripout on my local.
Thanks for the awesome tool!

from nbstripout.

kynan avatar kynan commented on July 23, 2024

That's a tricky one: the path to the Python interpreter and nbstripout are indeed hard coded - deliberately. The point is to make the filter work independently of the environment where it is run (i.e. where you run git).

When using conda environments / virtualenv, nbstripout is installed with a prefix that may not be in the $PATH of your default shell environment. Hence using the filter in that environment would fail if we were just calling nbstripout.

Do you have a good idea for how to resolve this?

from nbstripout.

AllanLRH avatar AllanLRH commented on July 23, 2024

Hmmm, I'm not that well versed in the internal mechanisms of git (./git/info/attributes and .attributes was news to me), but my best bet it to place a Python-script alongside the attributes-file, which returns the path of the relevant Python-interpreter (or print to stdout, in order to allow for Perl and bash scripts as well).
The script could

  1. Return a hard-coded path, thus replicating the current behavior – this could be the default behavior, and should be generated by the same mechanism as currently done be nbstripout --install.
  2. Return a path dependent on the machine executing the script – like checking name of the OS, the contents of the PATH-variable etc… the user would be responsible for cooking up this script up himself.

The scripts should not be pushed to the remote, but be confined to the local instance of the repo, thus allowing users to use more "hack-ish" solutions :)

What do you think?

from nbstripout.

kynan avatar kynan commented on July 23, 2024

Suppose we could have a wrapper script checking for existence of

  1. nbstripout in the $PATH
  2. the hard-coded script path from nbstripout --install

Maybe in reverse order...

from nbstripout.

kynan avatar kynan commented on July 23, 2024

FYI, since nbstripout can now be run as a module, we have changed the filters to use /path/to/your/python -m nbstripout i.e. it's still the full path to the interpreter, but no longer to the nbstripout entry point script. Does this help @AllanLRH ?

from nbstripout.

mereldawu avatar mereldawu commented on July 23, 2024

I have a similar issue, and my set up is

  • Local is OS X (zsh)
  • Remote is Linux container
  • nbstripout 0.3.9.
  • Also mount the relevant folders.

I first installed it in my local, but when I try to use nbstripout --install I'm receiving the following error:

command not found: nbstripout. 

Then I installed nbstripout inside the container and can use it without a problem.

But then when I do git status again in my local, I get the following error:

"/opt/conda/bin/python3.8" -m nbstripout: /opt/conda/bin/python3.8: No such file or directory
error: external filter '"/opt/conda/bin/python3.8" -m nbstripout' failed 127
error: external filter '"/opt/conda/bin/python3.8" -m nbstripout' failed

I like using zsh on my local for git since I have all the zsh customisation, but it's not a big issue.
Just thought I'd put it here, in case there's some easy way of resolving it.

from nbstripout.

kynan avatar kynan commented on July 23, 2024

@mereldawu, is /opt/conda/bin inside the container? The interpreter path is written at the point where you run nbstripout --install and the path of the active interpreter is used.

from nbstripout.

kynan avatar kynan commented on July 23, 2024

Great to hear you found a working solution!

from nbstripout.

mafloh avatar mafloh commented on July 23, 2024

I had a similar error:

zsh: /usr/local/bin/nbstripout: bad interpreter: /usr/local/opt/[email protected]/bin/python3.9: no such file or directory

I solved it by changing /usr/local/bin/nbstripout and replacing the shebang line with #!/usr/local/bin/python3. To find out the location of your python interpreter I did: which -a python3.

I had deinstalled python3.9 because of problems with homebrew because of M1.

Please Note: I am not sure how hacky this approach is. It solved the issue for me for now.

from nbstripout.

kynan avatar kynan commented on July 23, 2024

@mafloh that should be fine, as long as you always have nbstripout installed for your system python3.

Hard coding the interpreter path is a feature of entrypoint scripts as it's the only way to make sure the script is going to use the "right" interpreter. If you then uninstall said interpreter there's not much that could be done to avoid this failure...

FWIW, the alternative would have been to reinstall nbstripout with your system python3.

from nbstripout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.