You can use MySQL in R as follows:
> install.packages("RMySQL")
...
> library(RMySQL)
Loading required package: DBI
> connection = dbConnect(MySQL(), dbname='test')
> dbListTables(connection)
[1] "animal" "person"
>
Reference:
https://www.r-bloggers.com/accessing-mysql-through-r/
Sunday, May 21, 2017
Library not loaded: /opt/X11/lib/libSM.6.dylib
When you install RMySQL, you might encounter the following error:
> install.packages("RMySQL")
...
unable to load shared object '/Library/Frameworks/R.framework/Resources/modules//R_X11.so':
dlopen(/Library/Frameworks/R.framework/Resources/modules//R_X11.so, 6): Library not loaded: /opt/X11/lib/libSM.6.dylib
Referenced from: /Library/Frameworks/R.framework/Resources/modules//R_X11.so
Reason: image not found
>
Installing XQuartz solved the problem for me.
Reference:
http://stackoverflow.com/questions/26489928/cant-load-x11-in-r-after-os-x-yosemite-upgrade
> install.packages("RMySQL")
...
unable to load shared object '/Library/Frameworks/R.framework/Resources/modules//R_X11.so':
dlopen(/Library/Frameworks/R.framework/Resources/modules//R_X11.so, 6): Library not loaded: /opt/X11/lib/libSM.6.dylib
Referenced from: /Library/Frameworks/R.framework/Resources/modules//R_X11.so
Reason: image not found
>
Installing XQuartz solved the problem for me.
Reference:
http://stackoverflow.com/questions/26489928/cant-load-x11-in-r-after-os-x-yosemite-upgrade
Friday, May 19, 2017
Library not loaded: /usr/local/opt/gcc/lib/gcc/5/libgomp.1.dylib
When you run "import xgboost", you might encounter the following error:
OSError: dlopen(/Users/izeye/anaconda/lib/python3.5/site-packages/xgboost/./lib/libxgboost.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/5/libgomp.1.dylib
Referenced from: /Users/izeye/anaconda/lib/python3.5/site-packages/xgboost/./lib/libxgboost.so
Reason: image not found
Adding a symbolic link as follows works for me:
ln -s /usr/local/opt/gcc\@5 /usr/local/opt/gcc
OSError: dlopen(/Users/izeye/anaconda/lib/python3.5/site-packages/xgboost/./lib/libxgboost.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/5/libgomp.1.dylib
Referenced from: /Users/izeye/anaconda/lib/python3.5/site-packages/xgboost/./lib/libxgboost.so
Reason: image not found
Adding a symbolic link as follows works for me:
ln -s /usr/local/opt/gcc\@5 /usr/local/opt/gcc
Monday, May 15, 2017
/bin/sh: clang-omp++: command not found
When you install XGBoost with "pip install xgboost", you might encounter the following error:
/bin/sh: clang-omp++: command not found
make: *** [build/learner.o] Error 127
make: *** Waiting for unfinished jobs....
Doing as follows works for me:
brew install gcc@5
pip install xgboost
Reference:
https://github.com/dmlc/xgboost/issues/1501#issuecomment-292209578
/bin/sh: clang-omp++: command not found
make: *** [build/learner.o] Error 127
make: *** Waiting for unfinished jobs....
Doing as follows works for me:
brew install gcc@5
pip install xgboost
Reference:
https://github.com/dmlc/xgboost/issues/1501#issuecomment-292209578
ValueError: unknown locale: UTF-8
When you run a Python script, you might encounter the following error:
ValueError: unknown locale: UTF-8
Check your locale as follows:
Johnnyui-MacBook-Pro:~ izeye$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
Johnnyui-MacBook-Pro:~ izeye$
Add the following to your ".bash_profile":
export LANG=ko_kr.UTF-8
export LC_ALL=ko_kr.UTF-8
Check your locale again as follows:
Johnnyui-MacBook-Pro:~ izeye$ locale
LANG="ko_kr.UTF-8"
LC_COLLATE="ko_kr.UTF-8"
LC_CTYPE="ko_kr.UTF-8"
LC_MESSAGES="ko_kr.UTF-8"
LC_MONETARY="ko_kr.UTF-8"
LC_NUMERIC="ko_kr.UTF-8"
LC_TIME="ko_kr.UTF-8"
LC_ALL="ko_kr.UTF-8"
Johnnyui-MacBook-Pro:~ izeye$
Now it's working.
Note "ko_kr" is for Korean, so use yours.
ValueError: unknown locale: UTF-8
Check your locale as follows:
Johnnyui-MacBook-Pro:~ izeye$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
Johnnyui-MacBook-Pro:~ izeye$
Add the following to your ".bash_profile":
export LANG=ko_kr.UTF-8
export LC_ALL=ko_kr.UTF-8
Check your locale again as follows:
Johnnyui-MacBook-Pro:~ izeye$ locale
LANG="ko_kr.UTF-8"
LC_COLLATE="ko_kr.UTF-8"
LC_CTYPE="ko_kr.UTF-8"
LC_MESSAGES="ko_kr.UTF-8"
LC_MONETARY="ko_kr.UTF-8"
LC_NUMERIC="ko_kr.UTF-8"
LC_TIME="ko_kr.UTF-8"
LC_ALL="ko_kr.UTF-8"
Johnnyui-MacBook-Pro:~ izeye$
Now it's working.
Note "ko_kr" is for Korean, so use yours.
Friday, May 12, 2017
NameError: name 'spark' is not defined
With "pyspark" script, you have a "spark" object as follows:
SparkSession available as 'spark'.
>>> spark
<pyspark.sql.session.SparkSession object at 0x10d6dd898>
>>>
But with "python" or Jupyter Notebook (IPython Notebook), there's no "spark" object as follows:
>>> spark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'spark' is not defined
>>>
Add the following to your ".bash_profile":
export PYTHONSTARTUP="${SPARK_HOME}/python/pyspark/shell.py"
It's working but I'm not sure this is a right approach.
SparkSession available as 'spark'.
>>> spark
<pyspark.sql.session.SparkSession object at 0x10d6dd898>
>>>
But with "python" or Jupyter Notebook (IPython Notebook), there's no "spark" object as follows:
>>> spark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'spark' is not defined
>>>
Add the following to your ".bash_profile":
export PYTHONSTARTUP="${SPARK_HOME}/python/pyspark/shell.py"
It's working but I'm not sure this is a right approach.
Thursday, May 11, 2017
ImportError: No module named pyspark
When you import "pyspark", you might get the following error:
>>> import pyspark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pyspark
>>>
Install Spark first if it hasn't been installed yet.
Add the following to your ".bash_profile":
SPARK_HOME=/Users/izeye/Applications/spark-2.1.1-bin-hadoop2.7
export PYTHONPATH="${SPARK_HOME}/python/:$PYTHONPATH"
export PYTHONPATH="${SPARK_HOME}/python/lib/py4j-0.10.4-src.zip:$PYTHONPATH"
Now, it's working as follows:
>>> import pyspark
>>>
Now, it's working as follows:
>>> import pyspark
>>>
Monday, May 8, 2017
“ejabberd-17.04-osx-installer” is damaged and can’t be opened. You should move it to the Trash.
When you install "ejabberd" on Mac OS, you might encounter the following error:
“ejabberd-17.04-osx-installer” is damaged and can’t be opened. You should move it to the Trash.
You can work around as follows:
./ejabberd-17.04-osx-installer.app/Contents/MacOS/installbuilder.sh
“ejabberd-17.04-osx-installer” is damaged and can’t be opened. You should move it to the Trash.
You can work around as follows:
./ejabberd-17.04-osx-installer.app/Contents/MacOS/installbuilder.sh
Thursday, May 4, 2017
TypeError: extract() got an unexpected keyword argument 'expand'
If you got the following error:
TypeError: extract() got an unexpected keyword argument 'expand'
try "conda list" to check the version of "pandas":
pandas 0.17.1 np110py35_0
Update "pandas" with "conda update pandas" and try "conda list" again:
pandas 0.19.2 np111py35_1
Now it works.
TypeError: extract() got an unexpected keyword argument 'expand'
try "conda list" to check the version of "pandas":
pandas 0.17.1 np110py35_0
Update "pandas" with "conda update pandas" and try "conda list" again:
pandas 0.19.2 np111py35_1
Now it works.
Freezing with "conda install seaborn"
When freezing with "conda install seaborn" as follows:
mkl-2017.0.1-0 16% |##### | ETA: 0:45:43 35.41 kB/s
Just try with "conda install mkl" first and then try with "conda install seaborn".
It works for me but I didn't get why.
mkl-2017.0.1-0 16% |##### | ETA: 0:45:43 35.41 kB/s
Just try with "conda install mkl" first and then try with "conda install seaborn".
It works for me but I didn't get why.
Subscribe to:
Posts (Atom)