Error in loadNamespace(name) Cairo - python

It's my first time using R in jupyter. I've installed everything like jupyter, python, R and lRkernel. I can use just typing or calculation in jupyter but whenever I want to use a graph library like plot or ggplot2 it shows
Error in loadNamespace(name): there is no package called 'Cairo'
Traceback: plot without title
Someone please guide me about how to handle this issue.

I had the precise same issue and fixed it by installing Cairo package:
install.packages("Cairo")`
library(Cairo)
Thanks to my collegue Bartek for providing this solution

Related

TA-LIB module has no attribute 'add_all_ta_features'

I'm trying to use TA-lib for a hobby project. I found some code-snippets as reference telling me to do the following;
import talib as ta
ta.add_all_ta_features("some parameters here")
i get the following error when running the code:
ta.add_all_ta_features( AttributeError: module 'talib' has no attribute 'add_all_ta_features'
It looks like i need to manualy add all the features i want as i cant find the attribute .add_all_ta_features in the talib folder.
i've installed TA-Lib and made it a 64-bit library using Visual studio and managed to run TA-Lib in other projects before but have never used the .add_all_ta_features-attribute.
Does anybody know how i can fix this? Google seems to not return any usefull results when searched for this. The documentation i'm following also does not mention anything about this attribute.
i tried using pandas_ta and tried using the Google colab space, but both return the same error.
Found the problem. I was trying to use TA-Lib as TA, but nowhere was it specified that we need a seperate library, not findable through the python package mangager simply called TA.
Thanks!

How to use R package in python with importr package

I'm working on a web application using Dash, and I would like to use arules and aruleViz from R within a python script to get a graph of association rules obtained by using an Aprioi algorithm.
I found the rpy2 package and I installed it using conda conda install rpy2 ,then I try to import some packages like base tools by:
from rpy2.robjects.packages import importr`
arules = importr("tools",)`
That was fine(the package was imported)
And when I use: arules = importr("arules",) or arules = importr("arulesViz",)
I got receive the following error:
RRuntimeError: Error in loadNamespace(name) : there is no package called ‘arulesViz’
I saw an option in the importrpackage (lib_loc=None). I'm not sure how can I change it.
If there is any way to solve this, or if you know of a package in python that will help me plot a graph with vertices (I know how to so that with matplot.lib library using scatter but i'm not happy with it) I would greatly appreciate the help!
Thank you!
R packages must be installed before rpy2 can hope to find them. rpy2's importr() relies on R's own package loading system.
If you are certain to have installed that package earlier, you might have installed it in different directory, in a previous R process, and your current R process does not know about that directory. The optional named argument lib_loc accepts the path to that directory (see the doc).
(Note that there is also a utility function to check if an R package is installed without loading it)

“Error in sys$stdout$flush() : attempt to apply non-function”

I am trying to use the "reticulate" package in R to run python code in my R script. I have tried to run very simple commands just to see if it is working, and I get the following error every time.
“Error in sys$stdout$flush() : attempt to apply non-function”
I have uninstalled and installed both R and Python to the most up to date versions. I'm not sure what else to do, it seems the reticulate packages definitely works for others and only a few have had this issue with no clear answers as to why.
Please help!
library(reticulate)
py_run_string("import numpy as np")
py_run_string("my_python_array = np.array([2,4,6,8])")
print(my_python_array)
py_run_string("print(my_python_array)")
This may be the same issue as reported here: https://github.com/rstudio/reticulate/issues/584
In R, you can download the possible fix from the master branch at github:
devtools::install_github("rstudio/reticulate")

colaboratory will not acknowledge arviz after installation and import

In Google's colaboratory, installed arviz then did import arviz without error, but in a code cell, pm.plot_posterior(samples) gets error: arviz not installed.
Trying to plot Bayesian code
pm.plot_posterior(samples)
I expect a plot
Install Arviz prior to importing PyMC3, otherwise it apparently cannot find it. In your case, simply restarting the runtime (Runtime > Restart runtime...) should get it working.
Hi did you try adding the cell magic %matplotlib inline? This may be an issue where jupyter-notebook doesn't "know" to render the plot inline

How can I access to library " plot_utils " in python?

I need this library "plot_utils" for analysis and plotting but I can't find it in the web. this library is related to Brian2 (a library in python) for spiking neural network.
I installed brian2 through anaconda. when I want to import plot_utils and using in my code I receive error :
ModuleNotFoundError: No module named 'plot_utils'
Could you please help me?
You need to give more info about where did you stumble upon that name, eg some copied code etc.
With the only reference you've given (ie. brian2) this seems related.
https://brian2.readthedocs.io/en/stable/examples/frompapers.Stimberg_et_al_2018.plot_utils.html
Maybe just copy that code into a file named 'plot_utils.py' and keep it at the path your code is searching for it.
First, you need to install the module in your work environment using "pip install plot_utils" then you can import the library using "import plot_utils".
This link will help you: https://libraries.io/pypi/plot-utils[this is the official documentation from plot_utils]

Categories