Jupyterlab - find and replace globally ( all files and in all directories ) - jupyter-notebook

Is there any way to find and replace text string automatically in all folder's files? similar to what we get in sublime text, VS code etc

In JupyterLab you can open a terminal. Depending on the OS you use, you can use the tools from that OS to do the job. On Linux for example you can use find and sed to replace:
find path/to/folder -type f -exec sed -i 's/replace this/with this/g' {} \;
Other than that I do not think that this is a built-in functionality in JupyterLab.

You can install jupyterlab-search-replace extension, for example with pip:
pip install jupyterlab-search-replace
and the required ripgrep, for example on Ubuntu:
sudo apt-get install ripgrep
If you use a conda environment you can just install both with:
conda install -c conda-forge jupyterlab-search-replace ripgrep
For up-to-date installation instructions see the GitHub repository of the extension.
This extension requires JupyterLab 3 or newer.

Related

ZSH: commands do not support robotframework installation i.e. pip install robotframework command not found

I am Mac User (Big Sur 11.2.3) and I changed the Terminal from bash to zsh. I had a really hard time to install pip and set up the Environment Path and when I came to the point to install robotframework and all the paraphernalia I get a command not found on zsh.
Has someone sorted this out?
~ % pip install robotframework
zsh: command not found: pip
Are you using Python3 (which is installed on MacOS BigSur) to install roboframework?
Check path: which pyhton3
PIP-version: python3 -m pip --version
You can change shells zhs/bash/... for you install session, if that helps (to follow the roboFW install-guides).
zsh: command not found: pip means that the dir containing pip is not in your $path. There's probably something you forgot to copy from your .bashrc file to your .zshrc file. If you're using PyEnv to manage your Python versions (and you should!), then this is the line in question:
eval "$(pyenv init -)"

answer yes's to repeated unix prompts [duplicate]

I'm trying to uninstall all django packages in my superuser environment to ensure that all my webapp dependencies are installed to my virtualenv.
sudo su
sudo pip freeze | grep -E '^django-' | xargs pip -q uninstall
But pip wants to confirm every package uninstall, and there doesn't seem to be a -y option for pip. Is there a better way to uninstall a batch of python modules? Is rm -rf .../site-packages/ a proper way to go? Is there an easy_install alternative?
Alternatively, would it be better to force pip to install all dependencies to the virtualenv rather than relying on the system python modules to meet those dependencies, e.g. pip --upgrade install, but forcing even equally old versions to be installed to override any system modules. I tried activating my virtualenv and then pip install --upgrade -r requirements.txt and that does seem to install the dependencies, even those existing in my system path, but I can't be sure if that's because my system modules were old. And man pip doesn't seem to guarantee this behavior (i.e. installing the same version of a package that already exists in the system site-packages).
starting with pip version 7.1.2 you can run pip uninstall -y <python package(s)>
pip uninstall -y package1 package2 package3
or from file
pip uninstall -y -r requirements.txt
Pip does NOT include a --yes option (as of pip version 1.3.1).
WORKAROUND: pipe yes to it!
$ sudo ls # enter pw so not prompted again
$ /usr/bin/yes | sudo pip uninstall pymongo
If you want to uninstall every package from requirements.txt,
pip uninstall -y -r requirements.txt
on www.saturncloud.io, Jupiter notebooks one can use like this:
!yes | pip uninstall tensorflow
!yes | pip uninstall gast
!yes | pip uninstall tensorflow-probability
Alternatively, would it be better to force pip to install all dependencies to the virtualenv rather than relying on the system python modules to meet those dependencies,
Yes. Don't mess too much with the inbuilt system installed packages. Many of the system packages, particularly in OS X (even the debian and the derived varieties) depend too much on them.
pip --upgrade install, but forcing even equally old versions to be installed to override any system modules.
It should not be a big deal if there are a few more packages installed within the venv that are already there in the system package, particularly if they are of different version. Thats the whole point of virtualenv.
I tried activating my virtualenv and then pip install --upgrade -r requirements.txt and that does seem to install the dependencies, even those existing in my system path, but I can't be sure if that's because my system modules were old. And man pip doesn't seem to guarantee this behavior (i.e. installing the same version of a package that already exists in the system site-packages).
No, it doesn't install the packages already there in the main installation unless you have used the --no-site-packages flag to create it, or the required and present versions are different..
Lakshman Prasad was right, pip --upgrade and/or virtualenv --no-site-packages is the way to go. Uninstalling the system-wide python modules is bad.
The --upgrade option to pip does install required modules in the virtual env, even if they already exist in the system environment, and even if the required version or latest available version is the same as the system version.
pip --upgrade install
And, using the --no-site-packages option when creating the virtual environment ensures that missing dependencies can't possibly be masked by the presence of missing modules in the system path. This helps expose problems during migration of a module from one package to another, e.g. pinax.apps.groups -> django-groups, especially when the problem is with load templatetags statements in django which search all available modules for templatetags directories and the tag definitions within.
pip install -U xxxx
can bypass confirm

How to upgrade Atom Editor on Linux?

What is the best way to upgrade atom on Linux Ubuntu ?
I install atom using official doc
git clone https://github.com/atom/atom
cd atom
script/build
sudo script/grunt install
I created the following script to update my atom on Ubuntu 14.10.
#!/bin/bash
# Update atom from downloaded deb file
rm -f /tmp/atom.deb
curl -L https://atom.io/download/deb > /tmp/atom.deb
dpkg --install /tmp/atom.deb
echo "***** apm upgrade - to ensure we update all apm packages *****"
apm upgrade --confirm false
exit 0
The file atom_update is executable and needs to be called using su:
sudo ./atom_update
The above works, but nowadays I use the following:
sudo add-apt-repository -y ppa:webupd8team/atom
sudo apt -y update
sudo apt -y install atom
apm install \
file-icons \
tabs-to-spaces \
trailing-spaces \
xml-formatter
With the above setup
sudo apt -y upgrade
will update an installed atom to the latest version. The ppa is generally up to date.
Now, it looks like the easiest way is to download the new packaged version (.deb or .rpm) from the official releases and install it over your previous one: https://github.com/atom/atom/releases
It's now even easier with the APT package.
sudo add-apt-repository ppa:webupd8team/atom
sudo apt update
sudo apt install atom
And now you can upgrade / dist-upgrade as usual
sudo apt upgrade
Current official documentation seem to recommend another method:
Atom Github Page
Debian Linux (Ubuntu)
Atom is only available for 64-bit Linux systems.
Download atom-amd64.deb from the Atom releases page.
Run sudo dpkg --install atom-amd64.deb on the downloaded package.
Launch Atom using the installed atom command.
The Linux version does not currently
automatically update so you will need to repeat these steps to upgrade
to future releases.
Red Hat Linux (Fedora 21 and under, CentOS, Red Hat)
Atom is only available for 64-bit Linux systems.
Download atom.x86_64.rpm from the Atom releases page.
Run sudo yum localinstall atom.x86_64.rpm on the downloaded package.
Launch Atom using the installed atom command.
The Linux version does not currently
automatically update so you will need to repeat these steps to upgrade
to future releases.
Fedora 22+
Atom is only available for 64-bit Linux systems.
Download atom.x86_64.rpm from the Atom releases page.
Run sudo dnf install ./atom.x86_64.rpm on the downloaded package.
Launch Atom using the installed atom command.
The Linux version does not currently
automatically update so you will need to repeat these steps to upgrade
to future releases.
As of this writing, the best option to upgrade to the latest released version of Atom is to check out the most recent tag and build it, especially if you built it in the first place.
cd atom
git pull
git checkout v0.115.0 (or whatever the latest release is: https://github.com/atom/atom/releases)
script/build
sudo script/grunt install
wget https://atom.io/download/deb -O atom64.deb
sudo dpkg --install atom64.deb
or
wget https://atom.io/download/rpm -O atom64.rpm
sudo dnf install atom64.rpm
the above URLs redirect to https://atom-installer.github.com/
An easier way is to install the atom-updater-linux from the packages on the atom website.
Go to edit > preferences > install and search for atom-updater-linux
or from the terminal:
apm install atom-updater-linux
This should check for updates after every launch and prompt you to install new updates.
Currently the preferred procedure is described at the atom pages Installing Atom - Platform-linux
When using the add-apt-repository suggested in the top answer, this URL is suggested.
The apt repository mentioned at the Atom pages:
curl -sL https://packagecloud.io/AtomEditor/atom/gpgkey | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://packagecloud.io/AtomEditor/atom/any/ any main" > /etc/apt/sources.list.d/atom.list'
sudo apt-get update
If you are onn Ubuntu you can go to the Ubuntu Software Center, search for Atom and just click on Update. Then job done!
If anybody is interested, I wrote a small atom package for this purpose.
The package is meant to timely inform the user of new versions being available (stable or beta, configurable via settings) and uses GitHub API under the hood. It is platform independent, so it should work with any linux distro, but also with Windows or other systems.
It does not perform the upgrade automatically as I wrote it for my needs and I was not interested in such feature. I may add it in the future should strong interest for it manifest itself, though.
Feedback is welcome, best as tickets on github.
I upgraded from
Atom : 1.26.1
Electron: 1.7.11
Chrome : 58.0.3029.110
Node : 7.9.0
to
Atom : 1.40.1
Electron: 3.1.10
Chrome : 66.0.3359.181
Node : 10.2.0
I followed these simple steps,
create a file
sudo nano /usr/local/bin/atom-update
copy following snippet and save with Ctrl+o and "enter" and Ctrl+x
your code
#!/bin/bash
wget -q https://github.com/atom/atom/releases/latest -O /tmp/latest
wget --progress=bar -q 'https://github.com'$(cat /tmp/latest | grep -o -E 'href="([^"#]+)atom-amd64.deb"' | cut -d'"' -f2 | sort | uniq) -O /tmp/atom-amd64.deb -q --show-progress
dpkg -i /tmp/atom-amd64.deb
Make it executable
sudo chmod +x /usr/local/bin/atom-update
Run the script to upgrade atom
sudo atom-update
Ubuntu 16.04 and later
Run these commands to quickly and easily install and upgrade the Atom text editor snap package from the terminal in Ubuntu 16.04 and later (64-bit only).
Install Atom text editor:
sudo snap install --classic atom
Note that a snap in classic confinement behaves as a traditionally packaged application with full access to the system, and Atom extension packages are installed into the user's home directory.
Upgrade Atom text editor:
sudo snap refresh --classic atom
I would add that you should probably clean before updating the build to prevent some nasty errors.
cd atom
git pull
script/clean
script/build
sudo script/grunt install
For debian I have created a bash script which does the following:
Check with https://api.github.com and dpkg if atom is installed and/or up-to date.
Download and install the atom.deb from github if needed.
Provide a --beta switch if somebody wants to maintain the beta version as well.
Fell free to use it, it is located here: https://gist.github.com/rumpelsepp/8a953d6c092cbeb043695cfada114bef
Since December 2017 Atom provides official repositories for all major Linux distributions. You can find the latest installation instructions here.
Latest Way is to first install $ apm install atom-updater-linux then simply press Alt+Ctrl+U or go to Help and there is option for check for updates

How to uninstall Atom text editor on Linux?

i was reading the documentation looking for a way to cleanly uninstall Atom from my linux OS, but i didn't find anything related.
Is there a set of directories to delete? or maybe an script to run?
Thanks for the attention
I have posted the same question in the Github Project Repository and this is the complete answer: https://github.com/atom/atom/issues/2195#issuecomment-42917489
The commands to execute are:
sudo rm /usr/local/bin/atom
sudo rm /usr/local/bin/apm
rm -rf ~/atom
rm -rf ~/.atom
rm -rf ~/.config/Atom-Shell
sudo rm -rf /usr/local/share/atom/
For Ubuntu 14.04 & Ubuntu 18.04, use the following:
sudo apt-get remove atom
If you installed atom using the .deb package, you can remove it using this command:
sudo apt-get remove atom
If you want to remove any config directories, you can use this command:
sudo apt-get purge atom
Atom may also be installed as a Snap. You can find out by using:
$ sudo snap list
If you see it in the list you can remove it with:
$ sudo snap remove atom
For more on snaps:
https://www.ubuntu.com/desktop/snappy
In RHEL (I guess also Fedora/CentOS), just type: yum erase atom
on Ubuntu (15.04):
after installing the .deb from atom.io, I found the package available under the Ubuntu Software center.
I would use simply
sudo apt remove --purge atom
since it is also suggested in the (un-official) installation page here
On Ubuntu 14.04, with Atom 1.0, I didn't find anything under /usr/local/bin/.
However, the install was at /usr/share/atom/, which I deleted.
If you have installed Atom by .deb, then you can just remove by:
sudo dpkg -r atom
In fedora,it can be removed by:
sudo dnf remove atom

Nginx install on Mac OS X Lion. Cannot find PCRE

First up, I am trying to compile everything form source, I'm not using MacPorts or HomeBrew.
I have already installed pcre to /usr/local/pcre-8.21 and symlinked this to /usr/local/pcre.
I have set /usr/local/pcre/bin to my PATH variable here.
`/usr/local:/usr/local/mysql/bin:/usr/local/pcre/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin`
I am now trying to install Nginx, but I keep getting this message:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
I tried setting --with-pcre=/usr/local/pcre/bin but it just tries to re-install PCRE.
Can anyone help me get round this?
Thanks.
Nginx requires PCRE – Perl Compatible Regular Expressions(http://www.pcre.org/)
download PCRE and install PCRE:
cd pcre-8.01
./configure --prefix=/usr/local
make
sudo make install
in nginx folder type in to install:
cd nginx-0.8.33
./configure --prefix=/usr/local --with-http_ssl_module
make
sudo make install
The answer may already be found, but I still want to add my answer.
When you use ./configure you should use --with-pcre=/path/to/pcre/source. So let's say the source code was saved in /usr/local/src/pcre then the command will look like this:
./configure --with-pcre=/usr/local/src/pcre
Hope this helps someone!
I faced the same problem. These commands solved my problem:
Open MAC terminal and run this command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
then Run:
brew install pcre
Done!
Source: http://macappstore.org/pcre-2/

Resources