TensorFlow installation - pip - bash

I am following this guide to install pip: https://www.tensorflow.org/install/pip
When I run this command: . ./venv/bin/activate.fish
I get the following error:
-bash: ./venv/bin/activate.fish: line 4: syntax error near unexpected token -d'
-bash: ./venv/bin/activate.fish: line 4:function deactivate -d "Exit virtualenv and return to normal shell environment"'
Please assist.
thanks

The script activate.fish is intended for fish shell. You're running bash so it's a wrong script for bash. With bash use activate:
. ./venv/bin/activate

The command should be
$ source ./venv/bin/activate
if you are using bash in a Linux machine.

Related

`command not found` when using Bash Script to Install & Run a Software

I am trying to create a Bash script that downloads a .sh file, runs it to install a program (Anaconda for Python), then run the command conda init to activate the default Anaconda environment base
However, running my bash script as shown
# !#/bin/bash
wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
bash Anaconda3-*-Linux-x86_64.sh -b
echo 'export PATH=~/anaconda3/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
conda init
conda env create -f environment.yml
gives the error
./foo.sh: line 6: conda: command not found
./foo.sh: line 7: conda: command not found
Why is conda not found when trying to use it from within the Bash script, but is found if I relogin to the terminal?
How can we fix the Bash script so that using conda works?

source /.bash_profile command provide error

I run the command source ~/.bash_profile and get the following error:
$ source ~/.bash_profile
-sh: /Users/chaklader/.sdkman/contrib/completion/bash/sdk: line 37: syntax error near unexpected token `<'
-sh: /Users/chaklader/.sdkman/contrib/completion/bash/sdk: line 37: ` done < <(curl --silent "${SDKMAN_CANDIDATES_API}/candidates/all")'
The login shell that I use is bin/sh:
Whats the issue here and how to solve it?
This is how I solved the issue with the provided steps:
Install Homebrew from the docs on their homepage
Install Git using Homebrew (optional, but nice to have a more up-to-date git)
brew install git
Now install bash:
brew install bash
Add this install of bash to the allowed shells list:
echo '/usr/local/bin/bash' | sudo tee -a /etc/shells;
Homebrew installs things to /usr/local/Cellar/ by default, then symlinks any binaries to /usr/local/bin, so you've now got the latest bash sitting at /usr/local/bin/bash
Finally, change your shell to use this new one:
chsh -s /usr/local/bin/bash
Open a new terminal window/tab, and run these commands to double-check your work:
$ echo $SHELL
/usr/local/bin/bash
$ echo $BASH_VERSION
5.1.8(1)-release
This also solved the issue for running the source ~/.bash_profile whenever I open a new window in the terminal.
Reference:
The answer is from here How do I install Bash >= 3.2.25 on Mac OS X 10.5.8? by user jeffbyrnes

How to make virtualenvwrapper work in fish shell?

Is there any way to make virtualenvwrapper work in fish shell?
When trying to run virtualenvwrapper commands, like workon, I get the following error:
fish: Unknown command 'workon'
And when I run
source /usr/local/bin/virtualenvwrapper.sh
I get a very long error starting with:
fish: Expected a command name, got token of type 'Run job in background'. Did you mean 'COMMAND; and COMMAND'? See the help section for the 'and' builtin command by typing 'help and'.
/usr/local/bin/virtualenvwrapper.sh (line 67): if [ "$OS" = "Windows_NT" ] && [ "$MSYSTEM" = "MINGW32" ]
and ending with:
source: Error while reading file '/usr/local/bin/virtualenvwrapper.sh'
There are a number of alternatives, but the best approach I've found is https://github.com/adambrenecki/virtualfish
That will give you a .fish wrapper around virtualenv with all the virtualenvwrapper commands you are used to.

Unknown error when executing shell script

I have the following shell script (bash script) at cron.sh file
#!/bin/bash
WORKON_HOME="/home/django/domains/example.com"
PROJECT_ROOT="/home/django/domains/example.com/django-project/"
. $WORKON_HOME/bin/activate
cd $PROJECT_ROOT
python manage.py cron
But when i run:
$ sh cron.sh
I got the following error
: not found
: not found
/bin/activatepen /home/django/domains/example.com
Server info
cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.10
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu 9.10"
What am I doing wrong?
Your script has the wrong line endings. Pass it through dos2unix.
Well, you didn't show us everything in the code that you're trying to run. So I'll answer generically instead:
Run the script using sh -x cron.sh which will give you very verbose output of what it's doing up until the python invocation. If the errors are before that point, you know it's in the sh half and what caused them. If after that, you'll have to debug the python script.
Try using
bash -x cron.sh
or
./cron.sh
make sure to make it executable.

JSBuilder - trouble with command line build

I have a Sencha Touch application I am trying use JSBuilder to build which I am running this script in my Terminal:
bash JSBuilder.sh -v -p airside.jsb3 -d .\AirSide
But I am receiving this error:
JSBuilder.sh: line 11: ./jsdb/mac/jsdb: Permission denied
I am not sure how to fix this or what I am doing wrong?
Try putting sudo in front of the bash

Resources