TIL how to setup a default user profile in macOS Sierra. Everything must be done as root. Even sudo doesn't grant enough rights to get into the /System/Library/User Template/ folder. How to set environment variables in Python. Set environment variables on Mac OS X Lion. Adding directory to PATH Environment Variable in Windows. Setting Environment Variables for Node to retrieve. Command Line Tools not working - OS X El Capitan, Sierra, High Sierra, Mojave. Hot Network Questions.
Hi I am using mac, and have installed torch7, MATLAB and NVIDIA GPU (CUDA 8.0). When I run the run.m by MATLAB, I get the following results: - /vrn/face-alignment /vrn /bin/bash: th: command not found /vrn Landmarks extracted successfully. /bin/bash: th: command not found Error using run (line 70) Failed to run Torch7 script. Looks like 'th' and CUDA works properly since it responds 'Landmarks extracted successfully.'
But the second system call in the code gives this error. No idea what is this error from.
I greatly appreciate your help in advance! Hi monabiyan, The 'Landmarks extracted successfully' might actually be a small bug. It is possible that the return status is actually coming from popd, which is much less useful. (Edit: I've fixed this now) The most likely issue, if Torch is installed correctly, is that it isn't in the PATH environment variable. Did you add it to your.bashrc file when the Torch installed asked? You can also try adding something like system('.
$HOME/distro/torch/bin/activate-torch') at the top of run.m. Just be sure that that is actually the correct path.
Hope this helps. I am mistaken. The shell environment is not preserved between calls to system, so you have to add it to each block.
Find your torch-activate script and then modify each system block to look like this: retval = system('cd face-alignment;'. /usr/local/torch/install/bin/torch-activate; '. 'CUDAVISIBLEDEVICES=' num2str(gpunum). ' th main.lua -model 2D-FAN-300W.t7'. ' -input./' inputfolder. ' -detectFaces true'.
' -mode generate'. ' -output./' inputfolder. ' -outputFormat txt 2&1 /dev/null;'); and retval = system('. /usr/local/torch/install/bin/torch-activate; '. 'CUDAVISIBLEDEVICES=' num2str(gpunum). ' th ' pwd '/process.lua'.
' -model ' modelfile. ' -input ' inputfolder '/scaled/'. ' -output ' outputfolder); This will activate torch for each call of system. Please also make sure you have it in your $HOME/.bashrc or $HOME/.profile file (I'm not sure which one Mac uses). Hi I added the system('. $HOME/distro/torch/bin/activate-torch') command on top of the run.m file but it didn't work.
To prove that I have installed torch, I provided the following commands in terminal: $cd $th and Here I get: - Torch7 / / / / Scientific computing for Lua. / / / / / / Type? For help // // //// - So it is working. However, I also think it is not added in the path.
In order to find the '.bashrc' file i provided the following commands in the terminal to show all the hidden files: $cd $ls -a surprisingly there is no '.bashrc' file in the file list appear. So I think I should create this file and add the path. But can you help me on that? What is the Path statement exactly I should add after creating the '.bashrc' myself. BTW, I am using MacBook Pro (Retina, 13-inch, Early 2015) with macOS Sierra 10.12.6. Remove the 2&1 from the first system call so you can see stderr. The torch-activate script does quite a bit more than augmenting the PATH.
You need to run torch-activate in order to define some other variables, such as LUAPATH. Start by finding out where you installed Torch to: (rogue) $ which th /usr/local/torch/install/bin/th Replacing the last part th with torch-activate to form the line. /usr/local/torch/install/bin/torch-activate which you need to use in each call of the system block as in my. Retval = system('cd face-alignment;'.
/usr/local/torch/install/bin/torch-activate; '. 'CUDAVISIBLEDEVICES=' num2str(gpunum).
' th main.lua -model 2D-FAN-300W.t7'. ' -input./' inputfolder. ' -detectFaces true'. ' -mode generate'. ' -output./' inputfolder. ' -outputFormat txt '); If you do this, MATLAB will find torch. Thank you, Aaron, I think I am getting very close!.
I removed '2&1' from the first system call to see the error msg. In terminal I entered $ which th and found the address of my th which was different than your default suggestion: mine: '/Users/monabiyan/torch/install/bin/th' So I fixed that in both system calls in MATLAB. I no longer get error from that part. However, I am still getting a small error as following: /bin/bash: th: command not found Error using run (line 45) Failed to run Torch7 script. So '/bin/bash: th: command not found' is the main issue. Do you have any idea how to fix that?
Thank you so much Aaron. Yes, sorry, the line numbers changed a little bit since I commented out the previous system calls.
This error belongs to the first system call. My first system call is: retval = system('cd face-alignment;'. '/Users/monabiyan/torch/install/bin/torch-activate; '.
'CUDAVISIBLEDEVICES=' num2str(gpunum). ' th main.lua -model 2D-FAN-300W.t7'.
' -input./' inputfolder. ' -detectFaces true'. ' -mode generate'.
' -output./' inputfolder. ' -outputFormat txt /dev/null;'). Yes, Aaron, that was the space mistake. Now it worked! Thank you so much.
I tried many thing, didn't work. I finally found this: the recommendation provided by 'vzhong' worked and I installed fb.python which uses docker software to do it. I can answer a bit, it's really not easy to get everything working and the 'order' to install stuff is going to require some playing around with the person doing the installing as opposed to a simple checklist. I followed this for dlib:, running matlab inside the workon environment. I installed fblualib using that special fork of thpp for the compatibility with the current version of torch. I recommend only installing fb-python. Avoid installing the entire library as that will fail with the thpp requirement, also requiring a metric ton of other bullshit (I tried this).
I did all of this and got it working on ubuntu 16.04. Also, just in case, octave did not work edit: also some of the python code running through lua gave a seg fault (no message), I recommend just running the python code directly and see what messages crop up. One of them was because my fresh install didnt have python-tk (or matplotlib for that matter, doh), i think i did an apt-get install for python-tk, don't quite remember.
![Where Where](/uploads/1/2/5/6/125602654/867044837.jpg)
I was actually playing with it in Octave today. From what I can tell there is a minor issue with the patch function. It always shows the edge vertices even when I set the colour to none. It's mostly compatible, if you fancy submitting a patch that doesn't break the MATLAB version (I can check this if you don't have MATLAB), I'll gladly accept a pull request. Edit: and if that happens I'll try and build a docker image.
Another edit: just remembered that the isosurface function requires two arguments in octave. Setting this to a value of 1 will work.
Also, the lighting functions don't seem to exist but they can be disabled if octave. I found this.
I tried to run the project on Mac OS with XCode 8 and gcc 6.2. However, I failed to compile and install fb.python. There would raise a lot of errors if compiling fb.python using clang. Then I switched to gcc 6.2.
However, there would be a linking error 100% Linking CXX shared module lib.so Undefined symbols for architecture x8664: 'google::base::CheckOpMessageBuilder::NewStringabi:cxx11', referenced from: std::cxx11::basicstring, std::allocator. google::MakeCheckOpString(int const&, int const&, char const.) in Lib.cpp.o ld: symbol(s) not found for architecture x8664 It is quite frustrating.
If any of u have successfully run this project on Mac OS.
I've messed up my path variable, and now some apps that I run raise errors saying Command Not Found (error 127) for commands like date and sleep. These commands work fine when executed directly in the shell. I'm guessing this has something to do with a malformed $PATH variable, and need to know how to reset it. I've deleted the files /.bashrc, /.bashprofile, /etc/bash.bashrc, and /.bashrc and /.profile. What other files could hold my $PATH? Is there some simpler way to reset the Path than dig into the myriad files which could hold my path? Note, this path problem is only with my user.
I made a test user on my system, and the path was fine, back to normal. UPDATE: Thanks. I dunno which one of the files I deleted did it, but things are working again. You guys did what the 'Experts' couldn't.
And yes, Chris, you were right. The PATH customizations I had made were in bashlogin. But somehow it worked without me deleting those customizations. I think it might have been coz I was using this prefpane called 'RCEnvironment', and I had entered a path with quotes and:PATH in it. I dunno whether it takes quotes, and it doesn't replace:$PATH, so that probably is the root of the error. I forgot I even had that prefpane! If you have a /.MacOSX/environment.plist file, check it to see if it provides a default PATH value.
If it is in XML format (plists can be in many formats), you can edit with any text editor. Check it with plutil -lint /.MacOSX/environment.plist if you edit it by hand. Or, you can use commands like or to make controlled modifications to XML or binary format plist files.
![Sierra Sierra](/uploads/1/2/5/6/125602654/349837190.png)
You can always set your own PATH in any of your shell's initialization files. Put something like the following in your of your shell's startup files (.bashrc, or.bashprofile/.bashlogin/.profile): PATH=/usr/bin:/bin:/usr/sbin:/sbin export PATH # add custom, local installations to PATH PATH=/usr/local/bin:/usr/local/sbin:'$PATH' # add MacPorts to PATH PATH=/opt/local/bin:/opt/local/sbin:'$PATH' That will override whatever default PATH is set when the shell starts (the first PATH= does not use $PATH, so it will always start out with only whatever you give it). Only one of the ‘login’ files will ever be used (the first one that exists and is readable of /.bashprofile, /.bashlogin, and /.profile will be used).profile is for backwards compatibility with other shells—if you use it, be sure to keep it free of syntax that is specific to bash. If you go with.bashlogin or.bashprofile (they are functionally equivalent except for the names), then use a line like -e /.bashrc -a -r /.bashrc && source /.bashrc near the top so that login shells will also get the customizations made in your.bashrc. If you want all instances of bash to have the same PATH, then use.bashrc. If you often find yourself interactively modifying a single shell's PATH from the command line and want to use that modified PATH in subshells (a cases that is probably not terribly common), then you should put the statements in one of the ‘login’ files instead. Pick only one of the login files and use it.