Add TeX path to R Studio - Ubuntu - path

I'm having the same issue as this question:
When I open any .Rnw file, R Studio says that I have no TeX Distribution installed: I'm using Ubuntu 14.04 w/ Gnome and TeXLive 2014.
I include the line PATH=/usr/local/texlive/2014/bin:${PATH} in the Renviron.site file, which now looks like:
## Emacs please make this -*- R -*-
## empty Renviron.site for R on Debian
##
## Copyright (C) 2008 Dirk Eddelbuettel and GPL'ed
##
## see help(Startup) for documentation on ~/.Renviron and Renviron.site
# ## Example ~/.Renviron on Unix
# R_LIBS=~/R/library
# PAGER=/usr/local/bin/less
# ## Example .Renviron on Windows
# R_LIBS=C:/R/library
# MY_TCLTK="c:/Program Files/Tcl/bin"
# ## Example of setting R_DEFAULT_PACKAGES (from R CMD check)
# R_DEFAULT_PACKAGES='utils,grDevices,graphics,stats'
# # this loads the packages in the order given, so they appear on
# # the search path in reverse order.
PATH=/usr/local/texlive/2014/bin:${PATH}
However the problem persists. How can I fix this and run Sweave or knitR?

If anyone faces the same problem, I opened R Studio and checked the pdflatex installation with
> Sys.which("pdflatex")
pdflatex
""
Which show that it is in fact empty, so I run the command Sys.getenv("PATH")to check the current PATH:
Sys.getenv("PATH")
[1] "/usr/local/texlive/2014/bin:/usr/local/texlive/2014/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
To add my pdflatex Path, I had to find the pdflatex file on my texlive directory, which was /usr/local/texlive/2014/bin/x86_64-linux, then I added this to my current Path:
> Sys.setenv(PATH=paste(Sys.getenv("PATH"),"/usr/local/texlive/2014/bin/x86_64-linux",sep=":"))
And now it works perfectly
EDIT: the solution above works only for the open session and is only temporary, you have to run the code everytime you open a new session. I'm still trying to find a permanent solution

see this page: Customizing Startup, modify this file /usr/lib/R/etc/Rprofile.site, and put your code in this file. It looks like a permanent solution maybe.
===
i saw this file /etc/environment is the same as the output of Sys.getenv("PATH"), so i think that sys.getenv("PATH") reads file /etc/environment.
Therefore the better way is to modify this file /etc/environment adding this code :/usr/local/texlive/2017/bin/x86_64-linux​.
after i did it, i tried source /etc/envronment and restarted Rstudio, but it didn't work.
Finally it makes sense after i restarted my ubuntu system. ^_^
I hope my poor English expression is clear enough.

Related

Where is the .bashrc file on Windows? (Daniel Kehoe's learn-rails tutorial book)

I previously asked a similar question with regards to cloud9, but I am now trying to do the same project in parallel on my windows 10 machine because I will not have internet access to use cloud9. I am trying to set up the configuration in preparation for following Daniel Kehoe's learn-rails tutorial book, but I am having trouble setting up the environment variables. The book seems to explain how to do it on Mac but I can not find the file in the atom editor. the book says to type the command:
atom ~/.bash_profile
However this just creates a new file that is not part of my rails app project directory. i have also tried
atom ~/.bashrc
which is the alternative but with the same result. It just creates a file unrelated to my project. The file is supposed to already exist somewhere.
I am supposed to put the environment variables into a file called ".bashrc" but I don't know where to find this file as it is hidden. How can I locate and open this file with Atom text editor?
.bashrc , .bash_profile are used in unix based operating systems for the terminal. In windows you set environment variables differently. In windows 10, search for environment variables in start menu, and select Edit the system environment variables and set them from there.
PS: You can have .bashrc if you have installed something like git bash, cygwin bash or bash for windows 10 or something else. And all 3 handle .bashrc differently.
Typing echo ~ in the Git Bash terminal will tell you where that folder is which contains the .bashrc file

Changing homebrew-cask installation directories

I recently installed homebrew-cask and one of the things that I see is that it installs applications by default into the following directories:
Versioned package downloads => /opt/homebrew-cask/Caskroom/
Example : /opt/homebrew-cask/Caskroom/pdftk/2.02
Application binaries/libraries => /opt/
Example : /opt/pdftk/bin/
Instead of using the /opt directory, I would really like to use a directory located in /usr/local which is where my homebrew installation resides.
I can see from the docs that I can set an environment variable for #1, but I can't seem to figure out where to change #2.
I'd like to have the above two settings go to:
/usr/local/Caskroom/packages/pdftk/2.02
/usr/local/Caskroom/pdftk/bin
Any ideas on how I can change both settings or are there good ideas why I wouldn't want to do this?
Thanks.
From the Caskroom manual (specifically the Usage manual) you can change where the actual application will be installed by adding a line like this to your .bash_profile or .zshenv etc.
# Specify your defaults in this environment variable
export HOMEBREW_CASK_OPTS="--appdir=/Applications --caskroom=/usr/local/Caskroom"

Updated my path and now my program can't find my gems

I was having some trouble installing the gem libv8. Apparently I need to have python installed. I installed Python and was attempting to update my path with command from another forum:
SET PATH=C:[Ruby Directory]\bin;C:[Python Directory]
or in my case:
SET PATH=C:\Ruby192\bin;C:\Python27
I am not strong with paths and I can't figure out what I did. Now my environment can't find my Ruby directory.
Can someone explain what I did and how I might fix it?
That is most likely because your PATH variable already had a bunch of stuff that you simply throwed away with that line:
echo %PATH%
# a bunch of stuff
SET PATH=C:\Ruby192\bin;C:\Python27
echo %PATH%
# C:\Ruby192\bin;C:\Python27
You can try to append to it instead instead:
set PATH=%PATH%;C:\Ruby192\bin;C:\Python27
echo %PATH%
# a bunch of stuff plus C:\Ruby192\bin;C:\Python27
This change will be avalid for your terminal session only. Closing it and open again should restore the default path. If you need to make it permanent, you need to change your path throught the windows (for example, following this instructions)

How do I configure config.yml so that I can install devkit?

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Aaron>cd /DevKit
The system cannot find the path specified.
C:\Users\Aaron>cd \DevKit
C:\DevKit>ruby dk.rb init
Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
C:\DevKit>ruby dk.rb install --force
Invalid configuration or no Rubies listed. Please fix 'config.yml'
and rerun 'ruby dk.rb install'
C:\DevKit>
The config.yml looks like this:
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
I am completely stumped I have no clue what to do. Can someone tell me how to resolve this problem?
Yeah I don't think it could possibly be more vague. Basically, it's asking for one reference to your ruby installation. Mine lives in my Program Files directory since I prefer to keep all installed stuff in one spot, rather than straight on the C drive like is default (I'm on windows).
So, since my Ruby installation path is:
C:\Program Files\Ruby200-x64
My entire config.yml file is the following:
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- "C:/Program Files/Ruby200-x64"
Note, I put my Ruby filepath in quotes because it contains a space. If your path doesn't contain a space, then you won't need it.
I can see this being colossally confusing for a lot of people, so I hope this helps.
update
I'm seeing that spaces in file paths causes issues, so I've moved mine back down to the c:\ drive just because I don't want to deal with it. I recommend staying away from spaces in file paths unless you're willing to troubleshoot issues down the line.
So... that file is asking you to point to your ruby installation.
for me... mine looked like:
- C:\RailsInstaller\Ruby2.0.0
Write your path to ruby installation folder
The pattern is three dashes then move to next line
Add another dash, space and path
---
- C:\Ruby21-x64
(Since you can see three dashes have already been put at the
end of your config.yml file so you basically need to add the last line)
watch out of blank spaces! My problem was this maybe can be yours too !
You have to use slashes "/" instead of backslashes "\" on windows.
Worked for me on Win7x64

How to install ImageMagick on Windows 7 (2)

Hopefully, despite similar question titles, this isn't a duplicate issue.
I've installed ImageMagick-6.7.5-6-Q16-windows-dll.exe.
I have php_imagick_dyn-Q16.dll renamed to php_imagick.dll in PHP's ext directory.
I have extension=php_imagick.dll in my php.ini.
I try to run a basic test: php -r "var_dump(class_exists('Imagick'));".
I get this error:
PHP Startup: imagick: Unable to initialise module
Module compiled with module API=20060613
PHP compiled with module API=20090626
These options must match.
CLI has stopped working.
Windows can check online for a solution to the problem.
> Check online for a solution and close the program
> Close the program
What have I done wrong?
First install :
Link
Download :
http://www.sk89q.com/2010/03/vc6-windows-binaries-for-imagick-2-3-0/
Choose the TS one
Open your php.ini file
Add this line :
extension=php_imagick.dll
Restart your apache server
open php_info()
Now your imagick lib is ready to use.
This works for me.

Resources