Comments (10)
I realised instead of using nbstripout
directly, I can just use python -m nbstripout
on my local.
Thanks for the awesome tool!
from nbstripout.
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.
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
- 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
. - 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.
Suppose we could have a wrapper script checking for existence of
nbstripout
in the$PATH
- the hard-coded script path from
nbstripout --install
Maybe in reverse order...
from nbstripout.
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.
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.
@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.
Great to hear you found a working solution!
from nbstripout.
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.
@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)
- Should be agnosting on trailing blank lines HOT 9
- [Feature Request] Process Folders (Batch / Bulk) HOT 1
- Doesn't strip out pycharm metadata HOT 9
- New release HOT 2
- Replace cram with prysk HOT 2
- Read config from `setup.cfg` HOT 1
- Option to error on cell outputs exceeding `--max-size` HOT 4
- It is recommended to remove pytest-runnner from setup_requires in setup.py HOT 4
- Strip output_type=stderr only, with keep_output? HOT 4
- Possible nbstripout-fast integration HOT 6
- Prevent committing notebooks with errors in cell outputs HOT 6
- Specifying Python executable path in `nbstripout --install`
- 'nbstripout' is not recognized as an internal or external command, operable program or batch file. HOT 2
- Not compatible with `pre-commit-hooks/pretty-format-json` hook HOT 4
- `git config filter.nbstripout.extrakeys ` support for `attachments`? HOT 4
- Support setting defaults for command line arguments via git config
- No valid notebook detected HOT 4
- required = true by default or make doc more explicit about it HOT 5
- Support git-filter-repo HOT 2
- Any examples for --keep-id option? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nbstripout.