Torch / Lua after installation is not working - macos

I have followed the following approach in order to install Torch in my machine (Mac).
http://torch.ch/docs/getting-started.html#_
When I am done with the installation, I type:
$ luarocks install image
or $ luarocks lis
or $th
in order to load the th or to make updates on the lua packages. It says "command not found". Do you have any idea how I can resolve this issue?

If you're on a Mac using the bash terminal, make sure that you've permanently added /Users/you/torch/install/bin to your PATH.
To do this:
Navigate in your terminal to the root directory by running the command:
$ cd
Using the text editor of your choice (emacs, vim, etc.) open the .bash_profile file for editing. For example:
$ emacs .bash_profile
Add the following line to the end of the file (replacing 'you' with your Mac username):
PATH=$PATH\:/Users/you/torch/install/bin ; export PATH
Save and exit the text editor
Source the changes by running:
$ source .bash_profile
Check that your PATH has been updated (look for /Users/you/torch/install/bin in the string returned):
$ echo $PATH
To make sure it has been changed permanently, completely quit Terminal, open it and run echo $PATH again
Now try th and it should run Torch!
For more help on PATH:
https://kb.iu.edu/d/acar
The Torch installation (at least for me) added the line . /Users/jb/torch/install/bin/torch-activate to my .profile file, not .bash_profile. I tried adding that exact line to .bash_profile but it didn't work, so based on the recommendations here I got rid of the trailing directory and such.

Have you updated your PATH? It should include something like
/home/user/torch/install/bin

I faced the same issue and following this post deleted and reinstalled everything. However in the end what helped was adding /home/user/torch/install/bin/ to the PATH variable.

I have resolved the issue. I have deleted torch and I have installed it again. I have updated my PATH, and I have ran the $ luarocks install image command. After all of these, I was able to ran $ th command and in general torch.

Related

zsh: command not found on MacOS Monterey

I wanted to create a react project and when I executed the command it said zsh: command not found: npx
Then I tried the ls command and it said zsh: command not found: ls.
After setting the export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command both the ls and npx create-react-app command worked fine and when close the terminal and reopen again, the same command not found error shows.
Is there any permenent fix without setting export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command
For adding the variables to the path you need to add it to zshrc file for making that variable available locally.
The way you have used will only work until you use it in the same terminal window path only.
To solve the problem, follow these steps:
Goto you home directory
Simultaneously press cmd + shift + (.) Note:the last key is the key of dot
On following step 2, new hidden files will appear in home directory, look for (.zshrc) file and open it using any text editor.
Add your path variable in it, save and then close it.
Example: export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Open terminal and run the command: "echo $PATH" and see if your added variable is present in the output shown by terminal.
If yes, You are now ready to go to use it from anywhere in terminal now.
This is what worked for me on macOS Monterey,
Although I added the path to ./zshrc and sourced the file, after reopening the terminal the PATH was not exported
I followed these steps to solve this
Created .zprofile with touch .zprofile at the home directory. If the file already exists use that.
Add the required path to this file using vim or nano
eg: export PATH=${PATH}:/Users/Development/HashBaze/flutter/bin
If the above two steps don't work try sourcing both the .zprofile and .zshrc after following the above two steps.
This solution worked for me on macOS Monterey version 12.5

no such file or directory at share folder

When I start bash, the following description appears:
-bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or directory
-bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or directory
i'm using Microsoft-Windows-Subsystem-Linux, with ubuntu distro.
I already tried uninstalling by powershell pip uninstall virtualenvwrapper or in bash sudo pip uninstall virtualenvwrapper.
I also entered the share directory to delete the virtualenvwrapper folder, but it does not appear. I'm pressing LS and the folder does not appear.
I am also trying "which virtualenvwrapper" or "which virtualenvwrapper_lazy.sh" but this simply returns the same folder as I am.
i just need help to remove that message of bash
Most likely, there is a reference (potentially with source or .) to virtualenvwrapper_lazy.sh in one of bash startup files. Look at the usual suspects: ~/.bashrc, ~/.profile, /etc/profile, /etc/bash.bash.rc, /etc/.bash_login
To help with debugging, consider getting by adding set -x to ~/.bashrc, or by running interactive session
bash -ix /dev/null
UPDATE, based on log:
Per https://superuser.com/questions/893448/bash-shell-error-no-such-file-or-directory/1049989
I just had the same problem on Linux Mint.
The following file was causing the issue:
/etc/bash_completion.d/virtualenvwrapper
I made a backup (just in case) and deleted it, and everything seems to
be working fine now.

Error on terminal open: -bash: /nvm.sh: No such file or directory

Every time I open my terminal the first line says: -bash: /nvm.sh: No such file or directory.
I just installed nvm on this laptop and obviously I did something wrong.
Does anyone know what commands I can use to fix this?
I tried the following command to remove nvm from my laptop:
$ rm -rf ~/.nvm
Sadly, this did not fix my problem.
Check your .bashrc file (usually in the home folder). See answers to this question. There's probably a line reading /nvm.sh somewhere in there -- if so, just delete it.
As Gasper Stukelj awnsered:
There was a line reading /nvm.sh.
The correct path to the file was for me using macOS Mojave:
$ open ~/.bash_profile
In my case I fixed this problem, just putting in terminal, after installing nvm: export NVM_DIR="$HOME/.nvm" and [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
and after that I installed node normally
How did I find this solution?
Simple, I read the terminal, and it gave two ways to solve. The first option was for me to restart the computer, to see if the changes (installation) took effect, and the second option was for me to put these two commands in the terminal and only : )
Ready to use in my case :)
I used Google Translate
For me the issue was coming from the .bash_profile file. The line was:
source ~/.nvm/nvm.shexport PATH="/usr/local/opt/php#7.0/bin:$PATH"
I removed everything after nvm.she and the error isn't showing in the terminal anymore. This happened while trying to install xdebug on Mac Big Sur.
I failed to find a solution in Google searches, so I just installed nvm again to resolve the issue. I guess some files were not installed.
brew install nvm

Terminal is not working as usual mac after trying to install CakePHP

I was downloading the CakePHP framework for a project. Below the steps:
Installation
1) Install PHP 5.6 from: http://php-osx.liip.ch/
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
2) add the updated PHP version to our path. So we edit .profile file
nano ~/.profile
Add into the file
export PATH= /usr/local/php5/bin:$PATH
Then hit Control + O to write out the file
Then hit Control + X to save the file
exit
Restart the Terminal
Now the terminal doesn't work as usually. I've tried to understand the shell concept and apply different solutions, but I can't even find the .profile file again.
I obtain errors like:
enter code here-bash: ls: command not found
Anybody can explain me what's wrong and the shell concept to properly understand shell (-bash)?
The problem is this:
export PATH= /usr/local/php5/bin:$PATH
You killed your PATH variable. You need to find a way to edit .profile file, and change that line to:
export PATH=$PATH:/usr/local/php5/bin
You could try editing with the following command (using vim):
/usr/bin/vim /Users/yourname/.profile
Or (using nano):
/usr/bin/nano /Users/yourname/.profile
Or just remove .profile file completely by doing /bin/rm /Users/yourname/.profile. Of course, in any case, you need to restart your terminal once you're done.

How can I edit bash_profile if open command does not work and hidden file does not open in mac

I tried to change something in my bash_profile but I think I mistyped something. So I can not run any terminal commands. If I post "ls" command then I get
-bash: ls: command not found
Now I can not open bash_profile also. So what can I do here. I get the below path using echo command but there was some any other path. Please help.
echo $PATH: /usr/local/bin:/usr/local/bin:
But if I write /bin/ls it works.
MacBook Pro El Capitan : 10.11.4
This is the possible answer - And I solved it using nano editor
You messed up your PATH environment variable.
/bin/ls
works because you did not need PATH to find the 'ls' program. You can run ANY command by specifying its full path.
You need to re-edit your .bash_profile to either remove your PATH, or fix it. I do not know what editor you used to modify .bash_profile to begin with, but you can use
/usr/bin/nano
/usr/bin/vi (ONLY if you know vi/Vim)
/usr/bin/vim (ONLY if you know vi/Vim)
/usr/bin/emacs (I shutter to think about this)
TextWrangler (a very good free GUI text editor)
http://www.barebones.com/products/textwrangler/
Or you can just rename the current .bash_profile and start a new terminal session, then fix the renamed .bash_profile before putting it back in service
/bin/mv .bash_profile saved.bash_profile

Resources