Not able to Install Pymc3 in Jupyter Notebook - jupyter-notebook

I tired to install pymc3 using 'pip install pymc3', however, after installation when I tried to import pymc3 I still got the error message : ModuleNotFoundError: No module named 'pymc3'. Below is the warning messages I got from running pip install pymc3. Please help me to install pymc3 properly in Jupyter Notebook. Thank you!
Looking in indexes: https://ci-repo.aexp.com/repository/pypi/simple/
Collecting pymc3
Using cached https://ci-repo.aexp.com/repository/pypi/packages/pymc3/3.11.5/pymc3-3.11.5-py3-none-any.whl (872 kB)
Collecting cachetools>=4.2.1
Using cached https://ci-repo.aexp.com/repository/pypi/packages/cachetools/5.2.0/cachetools-5.2.0-py3-none-any.whl (9.3 kB)
Collecting semver>=2.13.0
Using cached https://ci-repo.aexp.com/repository/pypi/packages/semver/2.13.0/semver-2.13.0-py2.py3-none-any.whl (12 kB)
Collecting typing-extensions>=3.7.4
Using cached https://ci-repo.aexp.com/repository/pypi/packages/typing-extensions/4.3.0/typing_extensions-4.3.0-py3-none-any.whl (25 kB)
Collecting theano-pymc==1.1.2
Using cached https://ci-repo.aexp.com/repository/pypi/packages/theano-pymc/1.1.2/Theano-PyMC-1.1.2.tar.gz (1.8 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting deprecat
Using cached https://ci-repo.aexp.com/repository/pypi/packages/deprecat/2.1.1/deprecat-2.1.1-py2.py3-none-any.whl (9.8 kB)
Requirement already satisfied: pandas>=0.24.0 in c:\users\ycui2\appdata\local\programs\python\python310\lib\site-packages (from pymc3) (1.4.2)
Collecting fastprogress>=0.2.0
Using cached https://ci-repo.aexp.com/repository/pypi/packages/fastprogress/1.0.2/fastprogress-1.0.2-py3-none-any.whl (12 kB)
Collecting numpy<1.22.2,>=1.15.0
Using cached https://ci-repo.aexp.com/repository/pypi/packages/numpy/1.22.1/numpy-1.22.1-cp310-cp310-win_amd64.whl (14.7 MB)
Collecting scipy<1.8.0,>=1.7.3
Using cached https://ci-repo.aexp.com/repository/pypi/packages/scipy/1.7.3/scipy-1.7.3-cp310-cp310-win_amd64.whl (34.3 MB)
Requirement already satisfied: patsy>=0.5.1 in c:\users\ycui2\appdata\local\programs\python\python310\lib\site-packages (from pymc3) (0.5.2)
Collecting dill
Using cached https://ci-repo.aexp.com/repository/pypi/packages/dill/0.3.5.1/dill-0.3.5.1-py2.py3-none-any.whl (95 kB)
Collecting arviz>=0.11.0
Using cached https://ci-repo.aexp.com/repository/pypi/packages/arviz/0.12.1/arviz-0.12.1-py3-none-any.whl (1.6 MB)
Collecting filelock
Using cached https://ci-repo.aexp.com/repository/pypi/packages/filelock/3.7.1/filelock-3.7.1-py3-none-any.whl (10 kB)
Collecting netcdf4
Note: you may need to restart the kernel to use updated packages.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='ci-repo.aexp.com', port=443): Read timed out. (read timeout=15)")': /repository/pypi/packages/netcdf4/1.6.0/netCDF4-1.6.0-cp310-cp310-win_amd64.whl
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='ci-repo.aexp.com', port=443): Read timed out. (read timeout=15)")': /repository/pypi/packages/netcdf4/1.6.0/netCDF4-1.6.0-cp310-cp310-win_amd64.whl
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='ci-repo.aexp.com', port=443): Read timed out. (read timeout=15)")': /repository/pypi/packages/netcdf4/1.6.0/netCDF4-1.6.0-cp310-cp310-win_amd64.whl
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='ci-repo.aexp.com', port=443): Read timed out. (read timeout=15)")': /repository/pypi/packages/netcdf4/1.6.0/netCDF4-1.6.0-cp310-cp310-win_amd64.whl
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='ci-repo.aexp.com', port=443): Read timed out. (read timeout=15)")': /repository/pypi/packages/netcdf4/1.6.0/netCDF4-1.6.0-cp310-cp310-win_amd64.whl
ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='ci-repo.aexp.com', port=443): Max retries exceeded with url: /repository/pypi/packages/netcdf4/1.6.0/netCDF4-1.6.0-cp310-cp310-win_amd64.whl (Caused by ReadTimeoutError("HTTPSConnectionPool(host='ci-repo.aexp.com', port=443): Read timed out. (read timeout=15)"))
WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
You should consider upgrading via the 'C:\Users\ycui2\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command.

It's recommended to install Anaconda or Miniforge first. Furthermore, PYMC recently released v 4.0 which is much faster than the previous versions.
After installing any of the two above, you could then create a new environment as:
conda create -c conda-forge -n pymc_env "pymc>=4"
conda activate pymc_env
More details could be found here https://www.pymc.io/welcome.html

Related

to_categorical function in KerasR not working

I am using the to_categorical function in KerasR and it throws an error message in RStudio which is this:
mnist_y <- to_categorical(mnist_y, 10)
Collecting package metadata (current_repodata.json): ...working... failed
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.
Exception: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /conda-forge/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
Error: Python not available
See reticulate::use_python() to set python path,
then use kerasR::keras_init() to retry
I am using R 4.2.1. Based on the error message, it seems that I have to install Python on my computer, and set the Python path? I am not an experienced user of Python.
I tried installing the package OpenSSL, but I am still getting the same error.
Any help is greatly appreciated. Many thanks.

Some dependency issue while running rsync command which I'm not able to find

I was trying to mirror a site using rsync but it was failing to some reason and throwed the following error:
rsync: read error: Connection reset by peer (104)
rsync error: error in socket IO (code 10) at io.c(794) [Receiver=3.1.3]
The same command worked on different computers without installing any software (including rsync)
About the system (OS : Ubuntu 20.04, rsync version 3.1.3)

pre-commit giving error with mirrors-mypy, how do I fix it?

I am getting the below error when running "pre-commit run --all-files" and when trying to make a commit, it is some python error, python version in use is "Python 2.7.16".
[INFO] Installing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/Users/user/.cache/pre-commit/repoq_mv31g8/py_env-default/bin/python', '-mpip', 'install', '.', 'tokenize-rt==3.2.0', 'pydantic')
return code: 1
expected return code: 0
stdout:
Processing /Users/user/.cache/pre-commit/repoq_mv31g8
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting tokenize-rt==3.2.0
Using cached tokenize_rt-3.2.0-py2.py3-none-any.whl (6.1 kB)
Collecting pydantic
Using cached pydantic-1.9.0-cp310-cp310-macosx_11_0_arm64.whl (2.4 MB)
Collecting mypy==0.782
Using cached mypy-0.782-py3-none-any.whl (2.4 MB)
Collecting mypy-extensions<0.5.0,>=0.4.3
Using cached mypy_extensions-0.4.3-py2.py3-none-any.whl (4.5 kB)
Collecting typing-extensions>=3.7.4
Using cached typing_extensions-4.1.1-py3-none-any.whl (26 kB)
Collecting typed-ast<1.5.0,>=1.4.0
Using cached typed_ast-1.4.3.tar.gz (210 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: pre-commit-dummy-package, typed-ast
Building wheel for pre-commit-dummy-package (setup.py): started
Building wheel for pre-commit-dummy-package (setup.py): finished with status 'done'
Created wheel for pre-commit-dummy-package: filename=pre_commit_dummy_package-0.0.0-py3-none-any.whl size=1154 sha256=ea7d756fd19dee0f5f03851e3e343db4194f4b306f21fecb796b4d6d89d266fb
Stored in directory: /private/var/folders/v4/nlc505k12rn9pf4c9kntz8qm0000gn/T/pip-ephem-wheel-cache-4jcph5rz/wheels/80/78/0d/746d1697141e342b257e21c980fc51ac134e6b6400568c3646
Building wheel for typed-ast (setup.py): started
Building wheel for typed-ast (setup.py): finished with status 'error'
Running setup.py clean for typed-ast
Successfully built pre-commit-dummy-package
Failed to build typed-ast
Installing collected packages: typed-ast, mypy-extensions, typing-extensions, tokenize-rt, pydantic, mypy, pre-commit-dummy-package
Running setup.py install for typed-ast: started
Running setup.py install for typed-ast: finished with status 'error'
stderr:
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
running bdist_wheel
running build
running build_py
package init file 'ast3/tests/__init__.py' not found (or not a regular file)
running build_ext
building '_ast27' extension
building '_ast3' extension
ast3/Python/ast.c:844:5: warning: code will never be executed [-Wunreachable-code]
abort();
^~~~~
ast3/Python/ast.c:4514:9: error: implicit declaration of function '_PyUnicode_DecodeUnicodeEscape' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
^
ast3/Python/ast.c:4514:9: note: did you mean 'PyUnicode_DecodeUnicodeEscape'?
/opt/homebrew/opt/python#3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10/unicodeobject.h:608:23: note: 'PyUnicode_DecodeUnicodeEscape' declared here
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape(
^
ast3/Python/ast.c:4514:7: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for typed-ast
error: subprocess-exited-with-error
× Running setup.py install for typed-ast did not run successfully.
│ exit code: 1
╰─> [24 lines of output]
running install
/Users/user/.cache/pre-commit/repoq_mv31g8/py_env-default/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
package init file 'ast3/tests/__init__.py' not found (or not a regular file)
running build_ext
building '_ast27' extension
building '_ast3' extension
ast3/Python/ast.c:844:5: warning: code will never be executed [-Wunreachable-code]
abort();
^~~~~
ast3/Python/ast.c:4514:9: error: implicit declaration of function '_PyUnicode_DecodeUnicodeEscape' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
^
ast3/Python/ast.c:4514:9: note: did you mean 'PyUnicode_DecodeUnicodeEscape'?
/opt/homebrew/opt/python#3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10/unicodeobject.h:608:23: note: 'PyUnicode_DecodeUnicodeEscape' declared here
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape(
^
ast3/Python/ast.c:4514:7: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> typed-ast
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Check the log at /Users/user/.cache/pre-commit/pre-commit.log
I am running it on Apple M1 Air (macOS Big Sur), what am I missing or is it a known M1 issue ?
I have tried installing pydantic manually, pre-commit is installed by brew.
Thanks in Advance
pre-commit config:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 21.7b0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.782
hooks:
- id: mypy
additional_dependencies: [pydantic]
you're installing a very old version of mypy (0.782) which depends on an old version of typed-ast (<1.5.0) which does not support M1
you can ~usually get to the latest version by running pre-commit autoupdate -- or pick a version newer than 0.900 (where mypy started support for M1)
disclaimer: I created pre-commit
I am using Ubuntu 22.04.
In short, when I try git commit, it will report an error because I have installed pre-commit:
An unexpected error has occurred: CalledProcessError: command: ('python', '-mpip', 'install', '.')
return code: 1
expected return code: 0
stdout:
Executable `python` not found
First, we usually have python3 installed, so the python command is invalid.
Do it:
sudo apt install python-is-python3
Then, you usually encounter this problem in Ubuntu 22.04:
An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy immediately after install, please open an issue describing your environment
more info:
virtualenv python version did not match created version:
- actual version: <<error retrieving version from /home/wind/.cache/pre-commit/reposyb8net0/py_env-python3/bin/python>>
- expected version: 3.10.4.final.0
To fix this, add this line to your .bashrc file:
export SETUPTOOLS_USE_DISTUTILS=stdlib
Refresh the configuration file by restarting a terminal window or running source ~/.bashrc.

amdgpu-pro installation failed and now dependencies problem

first of all please bear with me as my English is still improving. So, yesterday i was trying to install DaVinci Resolve 16 on my newly installed Pop Os using an AMD RX 570 but i came across a problem related to openCL. So, i did some research and i found this command:
sudo apt install mesa-opencl-icd
Once, I did that and started DaVinci it crashed on startup with error "DaVinci Resolve quit unexpectedly "
Again I came to google for help and i found that i need to install amdgpu-pro drivers to get my gpu openCL support and i followed these instructions:
* you need to edit the "amdgpu-pro-install"-file.
* Change the string "ubuntu" to debian or debianlinux or so.
* The string "ubuntu" you can find in function os_release()
* With Linux Mint i need to change it to "linuxmint" and installation will be fine
so I followed the instructions and now it is giving me these errors:
Errors were encountered while processing:
amdgpu-dkms
amdgpu
amdgpu-pro-rocr-opencl
amdgpu-pro
amdgpu-pro-lib32
E: Sub-process /usr/bin/dpkg returned an error code (1)
and now i can't install or uninstall any pkg or deb file
-> sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up amdgpu-dkms (1:5.6.20.906316-1188099) ...
Removing old amdgpu-5.6.20.906316-1188099 DKMS files...
------------------------------
Deleting module version: 5.6.20.906316-1188099
completely from the DKMS tree.
------------------------------
Done.
Loading new amdgpu-5.6.20.906316-1188099 DKMS files...
Building for 5.8.0-7630-generic
Building for architecture amd64
Building initial module for 5.8.0-7630-generic
ERROR (dkms apport): kernel package linux-headers-5.8.0-7630-generic is not supported
Error! Bad return status for module build on kernel: 5.8.0-7630-generic (amd64)
Consult /var/lib/dkms/amdgpu/5.6.20.906316-1188099/build/make.log for more information.
dpkg: error processing package amdgpu-dkms (--configure):
installed amdgpu-dkms package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of amdgpu:
amdgpu depends on amdgpu-dkms (= 1:5.6.20.906316-1188099); however:
Package amdgpu-dkms is not configured yet.
dpkg: error processing package amdgpu (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of amdgpu-pro-rocr-opencl:
amdgpu-pro-rocr-opencl depends on amdgpu-dkms (= 1:5.6.20.906316-1188099); however:
Package amdgpu-dkms is not configured yet.
dpkg: error processing package amdgpu-pro-rocr-opencl (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of amdgpu-pro:
amdgpu-pro depends on amdgpu (= 20.45-1188099); however:
Package amdgpu is not configured yet.
dpkg: error processing package amdgpu-pro (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of amdgpu-pro-lib32:
amdgpu-pro-lib32 depends on amdgpu (= 20.45-1188099) | amdgpu-hwe (= 20.45-1188099No apport report written because the error message indicates it's a follow-up error from a previous failure.
No apport report written because the error message indicates it's a follow-up error from a previous failure.
No apport report written because MaxReports has already been reached
No apport report written because MaxReports has already been reached
); however:
Package amdgpu is not configured yet.
Package amdgpu-hwe is not installed.
amdgpu-pro-lib32 depends on amdgpu-pro (= 20.45-1188099) | amdgpu-pro-hwe (= 20.45-1188099); however:
Package amdgpu-pro is not configured yet.
Package amdgpu-pro-hwe is not installed.
dpkg: error processing package amdgpu-pro-lib32 (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
amdgpu-dkms
amdgpu
amdgpu-pro-rocr-opencl
amdgpu-pro
amdgpu-pro-lib32
E: Sub-process /usr/bin/dpkg returned an error code (1)
You should be able to uninstall amdgpu(-pro) drivers by running /usr/bin/amdgpu(-pro)-uninstall script.
Did you try to install the amdgpu drivers with the different kernel as advised here?

R "killed" when running install.packages('ANY', repos='http://cran.rstudio.com/') [duplicate]

I'm perplexed. I've done this process a dozen times and never had this issue.
I installed the latest version of R for Ubuntu
I enter R, no issues at all, gives me the latest version, and I can load native packages.
But When I try to install new packages, they download, but I get nothing. For example, if I install ggplot2:
> install.packages("ggplot2")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘colorspace’, ‘stringr’, ‘RColorBrewer’, ‘dichromat’, ‘munsell’, ‘labeling’, ‘plyr’, ‘digest’, ‘gtable’, ‘reshape2’, ‘scales’, ‘proto’
trying URL 'http://rweb.quant.ku.edu/cran/src/contrib/colorspace_1.2-4.tar.gz'
Content type 'application/x-gzip' length 242791 bytes (237 Kb)
opened URL
==================================================
downloaded 237 Kb
trying URL 'http://rweb.quant.ku.edu/cran/src/contrib/stringr_0.6.2.tar.gz'
Content type 'application/x-gzip' length 20636 bytes (20 Kb)
opened URL
==================================================
downloaded 20 Kb
[snip ... ]
trying URL 'http://rweb.quant.ku.edu/cran/src/contrib/ggplot2_0.9.3.1.tar.gz'
Content type 'application/x-gzip' length 2330942 bytes (2.2 Mb)
opened URL
==================================================
downloaded 2.2 Mb
The downloaded source packages are in
‘/tmp/RtmpoPUAFL/downloaded_packages’
> library(ggplot2)
Error in library(ggplot2) : there is no package called ‘ggplot2’
I've completely purged files a number of times, but not with any luck.
I'm logged in as root.
I feel like I'm missing something obvious? I don't know -- I've done this same thing a dozen times on Ubuntu, Mac, Windows, and Debian. Help?
#jdharrison helped out. The problem was insufficient memory on the VPS I was running, so I added some swap as described here:
How do you add swap to an EC2 instance?
Look at the last lines:
The downloaded source packages are in
‘/tmp/RtmpoPUAFL/downloaded_packages’
You have to go to the directory /tmp/RtmpoPUAFL/downloaded_packages (cd ...)
and then install them manualy in the order that is pointed out above. So
R CMD INSTALL colorspace_1.2-4.tar.gz
R CMD INSTALL stringr_0.6.2.tar.gz
R CMD INSTALL ggplot2_0.9.3.1.tar.gz
Then trylibrary(ggplot2) now it should work
I have no idea why you have to do this sometimes... I anyone knows i am happy to learn it as well.
If your server does not have enough ram, R can not install packages.
The solution is to either increase the physical ram, or increase the size of the swap file.
Create a 2 gig swap file
sudo fallocate -l 2G /swap.img
sudo mkswap /swap.img
sudo swapon /swap.img
You can see how much free swap is available with the swapon command
root#foo:# swapon -s
Filename Type Size Used Priority
/swap.img file 2097148 213388 -1

Resources