conda build r-ldavis/ not working - r

I am new to jupyter, and I am looking to install an R package (tseries) that is available on CRAN
I was trying to follow a question that was raised, but I think I am getting a different problem.
I was originally following this link
conda - How to install R packages that are not available in "R-essentials"?
But it seems obvious that the answer direct me to another link which is
https://www.continuum.io/content/conda-data-science
under the Building a conda R package
They said to run
conda skeleton cran ldavis
and then I got the following
C:\Users\Rami>conda skeleton cran ldavis
Tip: install CacheControl (conda package) to cache the CRAN metadata
Fetching metadata from http://cran.r-project.org/
Tip: install CacheControl (conda package) to cache the CRAN metadata
Traceback (most recent call last):
File "d:\Users\Rami\Anaconda3\Scripts\conda-skeleton-script.py", line 5, in <module>
sys.exit(conda_build.cli.main_skeleton.main())
File "d:\Users\Rami\Anaconda3\lib\site-packages\conda_build\cli\main_skeleton.py", line 65, in main
return execute(sys.argv[1:])
File "d:\Users\Rami\Anaconda3\lib\site-packages\conda_build\cli\main_skeleton.py", line 61, in execute
api.skeletonize(package, args.repo, config=config)
File "d:\Users\Rami\Anaconda3\lib\site-packages\conda_build\api.py", line 192, in skeletonize
recursive=recursive, config=config, **kwargs)
File "d:\Users\Rami\Anaconda3\lib\site-packages\conda_build\skeletons\cran.py", line 527, in skeletonize
raise RuntimeError("directory already exists: %s" % dir_path)
RuntimeError: directory already exists: .\r-ldavis
Please help me in steps as I am really new to this on windows 10

Thank you all for your remarks but the easiest way I found for not worrying about the r directory is through downloading the package directly from jupyter using the following command
install.packages('tseries', repos='http://cran.us.r-project.org')
This worked fine for me.

Related

InstallationWarning: package 'XYZ' is in use and will not be installed: R

I am trying to install package SBCK from R build using Rscript build.R -c -v -i in windows command prompt following the steps given here. However, I ended up with package SBCK being not installed because of following error/warning InstallationWarning: package 'SBCK' is in use and will not be installed. I have no package with name SBCK installed on my system, so I do not understand why I am getting this warning message and thus not to be able to install the R package.
I know that similar question have been asked before here but solution there does not work in my case.
I am using R version 4.2.0 on Windows 10.
Once 'build.R' is run, "SBCK_0.5.0.tar.gz" is created in the 'SBCK-R' folder.
You can now install it via the package archive file option or pointing to that file in the install.packages command. I faced the same issue and this solved it.

Tensorflow works in R command line but not Rstudio

I have installed the tensorflow package.
The following commands work fine in R command line
library(tensorflow)
sess = tf$Session
However when I run the same 2 linesin Rstudio I get the following error
Error: Python module tensorflow was not found
Detected Python configuration:
...
numpy: [NOT FOUND]
I suspect its numpy related but I have no idea.
This is my Rstudio information
rstudio::versionInfo()
$version
[1] ‘0.98.1103’
$mode
[1] "desktop"
Do I need to use a different version of Rstudio or is there more setup required to get tensorflow to work?
A bit more details after reading
https://github.com/rstudio/tensorflow/issues/87
import('numpy')
Error in py_module_import(module, convert = convert) : ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified path is invalid.
**************** FINAL EDIT *********************
I got this to work. But I have no idea why or how.
During install_tensorflow() in Rstudio, you are prompted to add the following to your PATH so I did
usr\appdata\local\programs\python\python36\Scripts
I removed it from my PATH and successfully ran tensorflow in Rstudio.
However, I added it back subsequently and could not replicate the error.
In the end I still don't know what is broken in Rstudio or what fixed it
Please use the following command to reload dynamic library paths
sudo ldconfig

Building and Installing cx_Oracle with conda skeleton/ conda build not working

I have installed the package cx_Oracle, using conda skeleton command on my Windows 64bits machine, within Anaconda python
conda skeleton pypi cx_Oracle
af5f7daad67d6820670d582dfc045/cx_Oracle-6.0rc1.tar.gz (200 KB) for cx_Oracle.
Downloading cx_Oracle
Using cached download
Unpacking cx_Oracle...
done
when I am checking the file/ directory is finally set, I see it there
File "C:\Anaconda3_version4.3\lib\site-packages\conda_build\skeletons\pypi.py", line 339, in skeletonize
raise RuntimeError("directory already exists: %s" % dir_path)
RuntimeError: directory already exists: .\cx_oracle
but when I am calling it, it cannot be found
import cx_oracle
Traceback (most recent call last):
File "<ipython-input-3-fa7af752f8a0>", line 1, in <module>
import cx_oracle
ModuleNotFoundError: No module named 'cx_oracle'
The directory of cx_Oracle contains the files,
and know I need to build the package with conda build:
conda build cx_Oracle
Just so, it still doesn't work
Provides me the following error:
Anaconda3_version4.3\conda-bld\cx_oracle_1499164
353203\_b_env\Library\include /Tcsrc/cx_Oracle.c /Fobuild\temp.win-amd64-3.6\Rel
ease\src/cx_Oracle.obj -DBUILD_VERSION=6.0rc1
error: command 'cl.exe' failed: No such file or directory
I do not understand what else is needed to finally install the package
Thanks for reading.
Finally, I got a hint about this error thanks to the comments from #darthbith,
Building cx_Oracle requires you to have working C(++) compiler since cx_Oracle is written in C, not in Python even it's a Python module.

pip cannot install Image or Pillow library on Windows 7

I downloaded Pillow binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil
for my version of Python (3.4.2) and Windows (32 bit).
pip install Pillow-3.4.2-cp36-cp36m-win32.whl fails with the error message below:
Pillow-3.4.2-cp36-cp36m-win32.whl is not a supported wheel on this platform.
The debug log is given below:
------------------------------------------------------------
C:\Python34\Scripts\pip run on 03/26/17 16:04:25
Pillow-3.4.2-cp36-cp36m-win32.whl is not a supported wheel on this platform.
Exception information:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 257, in run
InstallRequirement.from_line(name, None))
File "C:\Python34\lib\site-packages\pip\req.py", line 167, in from_line
raise UnsupportedWheel("%s is not a supported wheel on this platform." % wheel.filename)
pip.exceptions.UnsupportedWheel: Pillow-3.4.2-cp36-cp36m-win32.whl is not a supported wheel on this platform.
What am I doing wrong?
OK, I have found and fixed the problems. There were two. Writing them here hoping it would help someone.
First problem was: I have python version 3.4.2, but was trying to install Pillow-3.4.2-cp36-cp36m-win32.whl, which after some searches I realized was meant for Python 3.6.x (that is the cp36 part). This time I downloaded pillow-4.0.0-cp34-cp34m-win32.whl.
The second and the main problem was: my pip was outdated. After doing a python -m pip install --upgrade pip and then rerunning the original installation command pip install pillow-4.0.0-cp34-cp34m-win32.whl, everything worked fine.
Try
pip3 install pillow[........]

Cannot install R packages in Jupyter Notebook

I am trying to run R code in Jupyter and the R Kernel was added. Most of the time, packages can be installed successfully. However, some of the packages, such as RCurl and ggmap, would got error while installing.
Example:
install.packages("RCurl")
Warning message in install.packages("RCurl"):
“installation of package ‘RCurl’ had non-zero exit status”Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
What should I do?
Try to specify CRAN as repository in your install.packages statement when installing RCurl and ggmap. For example:
install.packages("RCurl", repos='http://cran.us.r-project.org')
This Stack Overflow post on installing R packages through Anaconda/Jupyter beyond those included in R essential provides more detail.
(Side note: I had encountered the same issue when trying to install R packages on computer clusters. This solution worked for me.)
use conda comment:
conda install r-RCurl
I kept getting the non-zero exit status when trying to install packages with Jupyter notebook with R kernel and was failing because of multiple dependencies when wanting to install a package. I am not an expert in any of these so please forgive me if I make an error in explaining or if it is a non-issue for you but please feel free to comment to clear things out. I just want to share my success story so hopefully it can help someone else: I am working on a MacBook Pro. Here are the information I get when I run R.version() on my jupyter notebook with R kernel:
$platform 'x86_64-conda_cos6-linux-gnu'
$arch 'x86_64'
$os 'linux-gnu'
$system 'x86_64, linux-gnu'
$language 'R'
$version.string 'R version 3.6.1 (2019-07-05)'
These are the steps to take to fix the issue:
Go to https://anaconda.org/
Search the package name that you are trying to install
Copy the one line that is given to install the package, it should be something like:
Conda install -c r r-caret #conda install -c r r-package_name
NOTE: sometimes during installing packages, you’re asked whether or not you want to continue, so add --y at the end of the above statement to continue, so something like this
Conda install -c r r-caret --y
(I will always add it just to be on the safe side)
Click on the new launcher (+ icon) to create a new notebook with PySpark (once opened it has .ipynp extension)
On the first cell paste the copied line from step 2 and run
Once done, restart the kernel on the current notebook
Restart the kernel on your other notebook with R kernel
Run library(package_name) on your notebook with R kernel (e.x. library(caret))
install.packages("Hmisc", .libPaths(), repos='http://cran.us.r-project.org')
This command will install the packagae in the conda
"/home/user/anaconda3/lib/R/library" and use the cran r repository as source.
Add path in Anaconda
As per this answer,
one can also add additional paths in anaconda to load libraries from (for eg., the location where R studio saves the user-installed packages) with
.libPaths( c( .libPaths(), "~/userLibrary") )
For example, the following worked for me:
In Anaconda :
.libPaths( c( .libPaths(), "C:\Users\name\Documents\R\win-library\3.5") )
When I tried to add anaconda's library path to RStudio, it resulted in errors (The procedure entry point MARK_NOT_MUTABLE could not be located in the dynamic link library << arose 4 times in succession) after installation of a package, though the package seemed to load.
Replace name with your local user folder name
Add/change path in RStudio
A useful link to make changes in default user-installed library paths :
https://www.accelebrate.com/library/how-to-articles/r-rstudio-library
To find out where a package has been installed:
find.package('package_name')
The directions nobody else supplied worked for me, but I found this guide, and it worked. Spent way too much time trying all these when I just needed a few simple commands. https://developers.refinitiv.com/en/article-catalog/article/setup-jupyter-notebook-r
I already had R and python installed, so I skipped to step 3. The only seems to mention windows, but it worked for me on mac as well. After following them I was able to install the packages using install.packages("dplyr", repos = "http://cran.us.r-project.org") in a cell in jupyter.
You have to create a directory in which your package will be and do for eg:
install.packages('ggplot2',loc='your directory')
First Step: You can install the IRkernel packages by running the following command in an R console:install.packages('IRkernel')
Second Step: You will have to make Jupyter see the newly installed R kernel by installing a kernel spec. To install system-wide, set user to False in the installspec command IRkernel::installspec(user = FALSE)
Setup Jupyter Notebook for R

Resources