Error using Polynomials in Julia - julia

I am trying to use polynomials for a code I have to run.
I updated all the packages and the package Polynomials is well added.
But when trying using Polynomials I have the following error message :
WARNING: Module Compat with uuid 12374366933959441 is missing from the cache.
This may mean module Compat does not support precompilation but is imported by a module that does.
ERROR: LoadError: Declaring precompile(false) is not allowed in files that are being precompiled.
Stacktrace:
[1] _require(::Symbol) at ./loading.jl:455
[2] require(::Symbol) at ./loading.jl:405
[3] include_from_node1(::String) at ./loading.jl:576
[4] include(::String) at ./sysimg.jl:14
[5] anonymous at ./:2
while loading xxx/.julia/v0.6/Polynomials/src/Polynomials.jl, in expression starting on line 8
ERROR: Failed to precompile Polynomials to xxx/.julia/lib/v0.6/Polynomials.ji.
Stacktrace:
[1] compilecache(::String) at ./loading.jl:710
[2] _require(::Symbol) at ./loading.jl:497
[3] require(::Symbol) at ./loading.jl:405
when asking versioninfo() I get the following :
Julia Version 0.6.1
Commit 0d7248e2ff (2017-10-24 22:15 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Xeon(R) CPU E5-2667 v2 # 3.30GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, ivybridge)
Does anyone understand what is happening?
Thank you

Related

Difficult installing R package pdftools

I am trying to install R package “pdftools” and encounter the following:
In file included from libqpdf/Pl_DCT.cc:1:
include/qpdf/Pl_DCT.hh:27:10: fatal error: 'jpeglib.h' file not found
#include <jpeglib.h>
^
1 error generated.
make: *** [libqpdf/Pl_DCT.o] Error 1
ERROR: compilation failed for package ‘qpdf’
I am using R version 3.3.3 on a mac with OS X 10.10.5 and can’t update my OS at the moment for a number of reasons.
I verified that the downloaded source packages are in:
/private/var/folders/t3/_mlp_5z15z9_628n5q00pw_s8d_kfs/T/RtmpnJERsz/downloaded_packages
I saw the following post:
'jpeglib.h' file not found
And ran
$ find /usr/local -name \*jpeg\* -print -name \*jpg\* -print
/usr/local/Cellar/boost/1.71.0/include/boost/gil/extension/io/jpeg
/usr/local/Cellar/boost/1.71.0/include/boost/gil/extension/io/jpeg.hpp
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Aliases/libjpeg
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Aliases/libjpeg-turbo
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpeg-archive.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpeg-turbo.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpeg.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpeginfo.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpegoptim.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/jpegrescan.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mjpegtools.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mozjpeg.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/openjpeg.rb
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/recoverjpeg.rb
find: /usr/local/jamf: Permission denied
The file "jpeglib.h" does not seem to be listed, but I located it in: /anaconda3/pkgs/jpeg-9b-he5867d9_2/include/jpeglib.h
Based on other posts, I tried from terminal:
$ brew install boost. (Lot of installing, no errors)
$ brew doctor (Lot of installing, no errors)
$ xcode-select: error: command line tools are already installed, use "Software Update" to install updates
$ brew install cairo gobject-introspection pixman (Lot of installing, no errors)
Then rebooted and tried installing pdftools again with same result.
Also saw this post but it was completely over my head:
https://www.cocoanetics.com/2012/01/helping-xcode-find-library-headers/
Any solutions in simple steps appreciated.
Here is my session info, I couldn't include it into comments due to restriction.
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] pdftools_2.2
loaded via a namespace (and not attached):
[1] compiler_3.4.3 tools_3.4.3 pillar_1.2.1 tibble_1.4.2
[5] Rcpp_1.0.1 qpdf_1.1 rlang_0.3.0.1 askpass_1.1
I just installed pdftools w/o any problem. Upgrading your R version may solve your problem.

Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object

I'm having this error when trying to attach package tidyselect and when trying to call tidyselect::any_function.
The error happens in Rstudio or command line alike, in RStudio it is triggered as soon as I type: tidyselect:: , though ?tidyselect:: works fine and I can call the help of ?tidyselect::any_function.
This also works:
packageVersion("tidyselect") # [1] ‘0.2.4
It used to work, and I don't understand what changed, I just know package rjava has been installed, the admins might also have changed something.
First a popup says:
The procedure entry point R_ContinueUnwind could not be located in the dynamic link library R.dll
Then an Error is displayed in the console :
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object '//edited_UNC_path.com/edited_path/tidyselect/libs/x64/tidyselect.dll':
LoadLibrary failure: The specified procedure could not be found.
The dll file exists :
file.exists('//edited_UNC_path.com/edited_path/tidyselect/libs/x64/tidyselect.dll') # [1] TRUE
config :
sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.1
Any idea how I can solve this ?
I don't know why this event happens as I am currently facing the same problem. Anyways I can explain your solution.
32 vs 64 bits
Your system is 64 bits, as shown in your sessionInfo(). i386 architecture is for the older systems, in 32 bits (they can only handle a limited amount of memory as they use 32 bits memory addresses, while 64 bits systems are, virtually, unlimited today).
What happens in R
A classic installation in R is "multiarch" for multi-architectures, which means 32 and 64 bits. In 64 bits systems there is no problem in building a 32 bits software. However, your may not have all the dependencies (e.g. C++ libraries) installed for both architectures. There is apparently a problem with your 32 bits installation. Then installing the package with INSTALL_opts="--no-multiarch" only installs the 64 bits version (the one you need), without problems.
This was solved by reinstalling tidyselect using :
install.packages("tidyselect",INSTALL_opts="--no-multiarch")
(Although the package could be install with install.packages("tidyselect") without error.
This answer pointed me to the solution (totally different question though).
It seems that it was indeed an issue with rjava.
Quoting the linked answer:
the solution was to use install option that simply forgets about i386 architecture. (also works with drat library and packages not from CRAN
It's all Chinese to me though and ?utils::install.packages doesn't help, I'll happily upvote / accept an answer that explains what's going on.

python in r: pandas not found

I am trying to improve my research by the combining of R and Python advantages. Reticulate package is a promising tool for this purpose. But something comes wrong...
devtools::install_github("rstudio/reticulate")
library(reticulate)
py_available()
[1] FALSE
py_config()
python: /usr/bin/python
libpython: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib
pythonhome: /System/Library/Frameworks/Python.framework/Versions/2.7:/System/Library/Frameworks/Python.framework/Versions/2.7
version: 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)]
numpy: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy
numpy_version: 1.8.1
python versions found:
/usr/bin/python
/usr/local/bin/python
/usr/local/bin/python3
/Users/User/anaconda/bin/python
use_python(" /Users/User/anaconda/bin/python")
I am using all "data science pack" under Anaconda. Thet is why the corresponded python version was chosen. All required packages are installed and they often in use via Jupiter notebook
py_available()
[1] TRUE
Yes, as expected!
py_module_available("pandas")
[1] FALSE
Not available for some reason(((
Thank you in advance for the ideas))
SessionInfo for a case:
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] ru_RU.UTF-8/ru_RU.UTF-8/ru_RU.UTF-8/C/ru_RU.UTF-8/ru_RU.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reticulate_1.1.0.9004
loaded via a namespace (and not attached):
[1] httr_1.3.1 compiler_3.4.1 R6_2.2.2 tools_3.4.1 withr_2.0.0 curl_2.8.1 memoise_1.1.0
[8] Rcpp_0.12.12 git2r_0.19.0 digest_0.6.12 jsonlite_1.5 devtools_1.13.3
I think you have to call use_python immediately after calling library(reticulate), before py_config or anything else.
That worked for me. More details in this question: Importing python module in R
You need to set the second argument of the function, so it should be:
For expample use_python("/users/my_user/Anaconda3/python.exe",required = TRUE)
DONT forget the required = TRUE

Re-initialize with packrat::init()

I have no idea how to make this problem reproducible, but here is a description of the problem nevertheless. I upgraded to R v 3.4.0 yesterday (sessionInfo() is below) and one of my RStudio projects couldn't update packages in packrat. After messing around with various "fixes" without success, I decided to delete packrat (packrat directory, project dir's .RStudio file) in the end. Unfortunately, I can't seem to re-initialize packrat in this project now. The following is the R output from
> packrat::init()
Initializing packrat project in directory:
- "~/my-project-path"
Error in isNamespaceLoaded(pkg) :
attempt to use zero-length variable name
In addition: Warning message:
In FUN(X[[i]], ...) : Package '' not available in repository or locally
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.0 magrittr_1.5 tools_3.4.0 yaml_2.1.14 stringi_1.1.5
[6] knitr_1.15.1 stringr_1.2.0 packrat_0.4.8-1 evaluate_0.10
Any help is very much appreciated. I thought about re-cloning the repo from github, but that would involve copy a large amount of files over from various directories that aren't under revision control currently.
Thanks!

R, keras: TypeError: Value passed to parameter 'shape' has DataType float32 not in list of allowed values: int32, int64

I'm trying to make some neural networks in R, using kerasR package on tensorflow within a tensorflow anaconda environment.
Here you can see my setup:
library(reticulate)
use_condaenv("tensorflow", required = TRUE)
py_config()
The result is:
python: C:\Users\Miguel\Anaconda3\envs\tensorflow\python.exe
libpython: C:/Users/Miguel/Anaconda3/envs/tensorflow/python35.dll
pythonhome: C:\Users\Miguel\ANACON~1\envs\TENSOR~1
version: 3.5.3 |Continuum Analytics, Inc.| (default, Feb 22 2017, 21:28:42) [MSC v.1900 64 bit (AMD64)]
Architecture: 64bit
numpy: C:\Users\Miguel\ANACON~1\envs\TENSOR~1\lib\site-packages\numpy
numpy_version: 1.12.1
python versions found:
C:\Users\Miguel\Anaconda3\envs\tensorflow\python.exe
C:\Users\Miguel\ANACON~1\python.exe
And this is my code:
library(kerasR)
mod <- Sequential()
mod$add(Dense(units = 200, input_shape = 13))
Which throws this error message:
Error in py_call_impl(callable, dots$args, dots$keywords) :
TypeError: Value passed to parameter 'shape' has DataType float32 not in list of allowed values: int32, int64
Detailed traceback:
File "c:\users\miguel\documents\github\keras\keras\models.py", line 430, in add layer(x)
File "c:\users\miguel\documents\github\keras\keras\engine\topology.py", line 558, in __call__ self.build(input_shapes[0])
File "c:\users\miguel\documents\github\keras\keras\layers\core.py", line 827, in build constraint=self.kernel_constraint)
File "c:\users\miguel\documents\github\keras\keras\legacy\interfaces.py", line 88, in wrapper return func(*args, **kwargs)
File "c:\users\miguel\documents\github\keras\keras\engine\topology.py", line 391, in add_weight weight = K.variable(initializer(shape), dtype=dtype, name=name)
File "c:\users\miguel\documents\github\keras\keras\initializers.py", line 208, in __call__ dtype=dtype, seed=self.seed)
File "c:\users\miguel\documents\github\keras\keras\backend\tensorflow_backend.py", l
Unfortunately, I cant`t find suggestions for this R / kerasR / tensrflow / anaconda setup. Your help will be truly appreciated.
My session info:
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252
[3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] kerasR_0.4.1 reticulate_0.7
loaded via a namespace (and not attached):
[1] tools_3.3.2 Rcpp_0.12.10 knitr_1.15
I also struggled with this issue, and attempted some of the hacks suggested in the support thread at https://github.com/statsmaths/kerasR/issues/13 without success.
The solution that worked in the end was abandoning the kerasR library altogether, in favour of keras by the RStudio team.
It seems to offer equivalent functionality, with the virtue of actually working; also, given that it appears to have support from the RStudio project, may stand a better chance of staying on top of the ongoing dependency hell that seems inevitable with DL frameworks in Python right now.

Resources