"Regionalization.ipynb is not trusted" issue with bw2regional - brightway

I managed to install bw2regional thanks to this post here
but now when I want to run/import it in my notebook, I still get the error message:
ModuleNotFoundError: No module named 'bw2regional'
in my powershell miniconda prompt, the following line appears in parallel:
1 - Regionalization.ipynb is not trusted
Did I not do the installation correct?
Thanks in advance for any help
Edit:
Here are the packages I installed in my environment:
(condashell) PS C:\Users\reim> conda list
# packages in environment at C:\Users\reim\Miniconda3\envs\condashell:
#
# Name Version Build Channel
[I ommited some for claritys sake here]
brightway2 2.3 py_2 cmutel
brotlipy 0.7.0 py38h294d835_1001 conda-forge
bw2analyzer 0.9.4 py_1 cmutel
bw2calc 1.8.0 py_0 cmutel
bw2data 3.6.2 py_0 cmutel
bw2io 0.7.12 py_0 cmutel
bw2parameters 0.6.6 py_0 cmutel
bw2regional 0.5.2 py_0 cmutel
bw_migrations 0.1 py_0 cmutel
[I ommited some for claritys sake here]

It seems like there are at least two things happening here.
You have a Jupyter notebook installed in a different environment than bw2regional
The reason I think this is that you can import bw2regional. I guess you should be able to run conda install jupyter in the same environment that you ran conda install bw2regional. If this sounds confusing, please read a bit on managing conda environments.
Your notebook is not trusted.
Not sure why this would be happening - hard to tell without knowing your OS, configuration, where you got the notebook, etc. But you can read about the Jupyter security policy, maybe that helps.

Related

conda create an environment without yaml or text file [duplicate]

This question already has answers here:
Install everything from a `conda list` output
(2 answers)
Closed 1 year ago.
I deleted a conda environment by mistake, and I do not have a yaml/text file containing the list of libraries. However, I have the following data:
Name
Version
Build
Channel
_tflow_select
2.1.0
gpu
anaconda
absl-py
0.13.0
pypi_0
pypi
aiohttp
3.6.3
py37he774522_0
anaconda
alabaster
0.7.12
pypi_0
pypi
anyio
2.0.2
pypi_0
pypi
appdirs
1.4.4
pypi_0
pypi
argon2-cffi
20.1.0
py37he774522_1
anaconda
ase
3.21.0
pypi_0
pypi
asgiref
3.3.1
pypi_0
pypi
astor
0.8.1
py37_0
anaconda
astroid
2.5.2
pypi_0
pypi
async-timeout
3.0.1
py37_0
anaconda
async_generator
1.10
py37h28b3542_0
anaconda
attrs
20.2.0
py_0
anaconda
azure-core
1.10.0
pypi_0
pypi
azure-eventhub
5.1.0
pypi_0
pypi
azure-storage-blob
12.6.0
pypi_0
pypi
Please note that above table is a just the first few libraries present in the environment.
Can anyone please suggest me a way to create an environment using the following information?
Please do not ask me to install the libraries one by one as there are many libraries to be installed. Also, do not suggest me to create a .yml/.txt file and then use conda/pip to install all of them at a go, as putting everything in the correct format would take a lot of time.
Please let me know if those two are the only solutions to this problem.
Merv's comment to my question:
This looks like the output from the conda list. Is that what you have?
I made a script for converting to YAML - see
stackoverflow.com/a/65912328/570918
I referred to that link, and it helped me resolve my problem.
Thanks, Merv.
There's another workaround for this problem which is quite tedious, so I recommend people facing similar issues to follow Merv's answer.

Unable to install tensorflow using conda with python 3.8

Recently, I upgraded to Anaconda3 2020.07 which uses python 3.8. In past versions of anaconda, tensorflow was installed successfully. Tensorflow failed to be installed successfully in this version.
I ran the command below;
conda install tensorflow-gpu
The error message that I received is shown below;
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- tensorflow-gpu -> python[version='3.5.*|3.6.*|3.7.*|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0|>=2.7,<2.8.0a0']
Your python: python=3.8
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
The following specifications were found to be incompatible with your CUDA driver:
- feature:/win-64::__cuda==11.0=0
Your installed CUDA driver is: 11.0
Is there a conda command with the right parameters to get tensorflow installed successfully?
UPDATE:
TF is now compatible with Python 3.8
Tensorflow is not compatible with Python 3.8. See https://www.tensorflow.org/install/pip
You need to downgrade your python version :
conda install python=3.7
Create an environment with python 3.7 and then activate it:
conda create -n p37env python=3.7
conda activate p37env
And install tensorflow.
This worked for me, and found out the answer from the Anaconda user guide (under how to use a different python version: https://conda.io/projects/conda/en/latest/user-guide/getting-started.html#managing-python )
From the requirement page:
Python 3.8 support requires TensorFlow 2.2 or later.
So there is a verison of Tensorflow compatible with python 3.8.
The problem is that TensorFlow 2.2.0 is not available through conda on Windows, this should be the reason why you get PackagesNotFoundError when running
conda install tensorflow=2.2
EDIT 15/03/21
Tensorflow 2.3.0 is compatible with Windows
i think we have two options here
pip install tensorflow
or we can use another env of anaconda such as like this below
conda create -n tf tensorflow pydotplus jupyter
conda activate tf
Actually you can directly use pip inside anaconda prompt, after I tested it, I found the conda is capable with pypi, first run the anaconda prompt with administrator permission (in windows), then enter "conda update --all" to make sure all the packages are latest, finally enter "pip install tensorflow" to install (the new version of tensorflow already includes tensorflow-gpu).
Then using VS code to open an ipynb and run
import tensorflow as tf
tf.test.gpu_device_name()
everything looks good.
For more info please refer to Anaconda official docs: https://docs.anaconda.com/anaconda/ .
Latest development for tensorflow installation on anaconda.
https://anaconda.org/anaconda/tensorflow
https://anaconda.org/anaconda/tensorflow-gpu
9 days ago, Anaconda uploaded a new tensorflow v2.3 package. Anaconda3 2020.07 (uses python v3.8) users can easily upgrade to tensorflow v2.3 with the following commands;
conda install -c anaconda tensorflow
conda install -c anaconda tensorflow-gpu
I have personally tested that the installation worked successfully.
The other answers for this question have now become obsolete.
Expanding upon William's answer here with more explicit instructions and caveats. Pip is the recommended way to install latest version of tensorflow as per tensorflow's installation instructions -- "While the TensorFlow provided pip package is recommended, a community-supported Anaconda package is available."
Here is the code that uses pip to do the installation in a Conda environment:
conda create -n env_name python=3.8
conda activate env_name
conda install pandas scikit-learn matplotlib notebook ##installing usual Data Science packages that does include numpy and scipy
pip install tensorflow
python -c "import tensorflow as tf;print(tf.__version__)" ##checks tf version
In general, we should be careful while mixing two package managers (conda and pip). So, it is suggested that:
Only after conda has been used to install as many packages as possible
should pip be used to install any remaining software. If modifications
are needed to the environment, it is best to create a new environment
rather than running conda after pip.
For an example, if we would like to install seaborn in the just created env_name environment, we should:
conda create --name cloned_env --clone env_name
conda activate cloned_env
conda install seaborn
Once we check the cloned_env environment is working fine, we can delete the env_name environment.
I was running into the same issue in conda prompt for Python 3.8.5 and fixed it using a Python wheel instead. Here are the steps:
Open conda prompt and install pip if you don't have it already: python -m pip install --upgrade pip
python -m pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.4.0-cp38-cp38-win_amd64.whl
Note: If you need a CPU specific tensorflow, use this wheel: https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow_cpu-2.4.0-cp38-cp38-win_amd64.whl
I just downgraded python to 3.7 as tf is not avialable to 3.8 version also I cannot use virtualenv for code that's why
The only working answer for me is:
conda install -c conda-forge tensorflow
It appears that tensorflow 2.5 on GPU has issues with spyder. So, I made new environment and installed tensorflow gpu as suggested by anaconda. Now I have to use either prompt or jupyter . At least it works
For macos users I suggest create an environment with python 3.7 and install tensorflow there.
You can run these commands too:
conda create -n new_env_name python=3.7
conda activate new_env_name
I had a similar problem in Anaconda Spyder. Here was my solution (In the Anaconda Console):
conda install pip
pip install tensorflow ==2.2.0

pip install in virtualenv on EC2 missing packages in requirements.txt file on install

I am pip installing a variety of packages inside a virtual environment on an EC2 instance (2018-03). Pip successfully installs some of the packages, but not all. I am using pip install --force-reinstall -r requirements.txt on the following requirements file, which was created on a system with a working instance with Python 3.7.4 on Macos:
alembic==1.1.0
bcrypt==3.1.7
boto3==1.9.156
botocore==1.12.249
certifi==2019.9.11
cffi==1.12.3
chardet==3.0.4
Click==7.0
coverage==4.5.4
docutils==0.15.2
Flask==1.0.2
Flask-Bcrypt==0.7.1
Flask-Login==0.4.1
Flask-Migrate==2.5.2
Flask-Script==2.0.6
Flask-Session==0.3.1
Flask-SQLAlchemy==2.4.0
Flask-WTF==0.14.2
idna==2.8
itsdangerous==1.1.0
Jinja2==2.10.1
jmespath==0.9.4
lxml==4.3.2
Mako==1.1.0
MarkupSafe==1.1.1
numpy==1.16.2
pandas==0.24.2
patsy==0.5.1
psycopg2==2.8.3
pycparser==2.19
python-dateutil==2.8.0
python-editor==1.0.4
pytz==2019.2
requests==2.21.0
s3transfer==0.2.1
scikit-learn==0.20.3
scipy==1.2.1
six==1.12.0
SQLAlchemy==1.3.8
statsmodels==0.9.0
trimesh==3.1.11
urllib3==1.24.3
Werkzeug==0.15.5
WTForms==2.2.1
And pip gives me the following message:
Successfully installed Click-7.0 Flask-1.0.2 Flask-Bcrypt-0.7.1 Flask-Login-0.4.1 Flask-Migrate-2.5.2 Flask-SQLAlchemy-2.4.0 Flask-Script-2.0.6 Flask-Session-0.3.1 Flask-WTF-0.14.2 Jinja2-2.10.1 Mako-1.1.0 MarkupSafe-1.1.1 SQLAlchemy-1.3.8 WTForms-2.2.1 Werkzeug-0.15.5 alembic-1.1.0 bcrypt-3.1.7 boto3-1.9.156 botocore-1.12.249 certifi-2019.9.11 cffi-1.12.3 chardet-3.0.4 coverage-4.5.4 docutils-0.15.2 idna-2.8 itsdangerous-1.1.0 jmespath-0.9.4 lxml-4.3.2 numpy-1.16.2 pandas-0.24.2 patsy-0.5.1 psycopg2-2.8.3 pycparser-2.19 python-dateutil-2.8.0 python-editor-1.0.4 pytz-2019.2 requests-2.21.0 s3transfer-0.2.1 scikit-learn-0.20.3 scipy-1.2.1 six-1.12.0 statsmodels-0.9.0 trimesh-3.1.11 urllib3-1.24.3
However when I do a pip list I only see the following packages installed. Note that coverage and psycopg2, for example, were listed as successfully installed, but don't show. Consequently, a quick python -c "import coverage" will fail.
Package Version
---------------- ---------
alembic 1.1.0
boto3 1.9.156
botocore 1.12.249
certifi 2019.9.11
chardet 3.0.4
Click 7.0
docutils 0.15.2
Flask 1.0.2
Flask-Bcrypt 0.7.1
Flask-Login 0.4.1
Flask-Migrate 2.5.2
Flask-Script 2.0.6
Flask-Session 0.3.1
Flask-SQLAlchemy 2.4.0
Flask-WTF 0.14.2
idna 2.8
itsdangerous 1.1.0
Jinja2 2.10.1
jmespath 0.9.4
Mako 1.1.0
patsy 0.5.1
pip 19.3.1
pycparser 2.19
python-dateutil 2.8.0
python-editor 1.0.4
pytz 2019.2
requests 2.21.0
s3transfer 0.2.1
setuptools 41.6.0
six 1.12.0
trimesh 3.1.11
urllib3 1.24.3
Werkzeug 0.15.5
wheel 0.33.6
WTForms 2.2.1
My questions are:
Are there ways to resolve with pip options other than --force-reinstall and --no-cache-dir, which I have already tried?
Could my issue relate to the fact that the latest supported package of Python I can grab on EC2 is 3.6.8, but my requirements.txt file was created on a 3.7.4 system? (Yes yes, I know, next time I'll be wiser and just use docker from the start.)
After much hand-wringing and nearly doing Docker bootcamp, I decided to go back for another round and found the underlying problem. Inside my virtual environment, I noticed that pip list was only listing packages as listed in the $MYENV/lib/Python3.6/data/dist-packages, whereas the offending packages were all located in $MYENV/lib64/Python3.6/data/dist-packages. This led to some additional searching and this response, which suggests symlinking the lib64 version of dist-packages to the lib version, which did the trick and resolved my issue. I'm using pip version 19.3.1, and the referenced article is from over 2 years ago, so I will definitely be talking to some folks.
However, for those who want the quick solution, here are the steps.
Fresh virtual environment: Set up a fresh virtual environment as you normally would.
Symlink BEFORE pip: Do your symlinking before you start installing any packages. Generally this will look something like:
ln -s $YOURENV/lib/Python3.x/data/dist-packages $YOURENV/lib64/Python3.x/data/dist-packages
Go ahead and pip: No you can pip install -r requirements.txt as you normally would. Double-check with a pip list and you should see all your packages listed.

How to change Python version in Anaconda, install Numpy and sklearn 0.17?

I'm new to machine learning. I literally have no idea what I'm doing but I need tools to understand how machine learning works.
I just download Anaconda Python from here. I saw that the version I downloaded is 3.7 but I need a 3.5.
I don't really understand how to install Numpy 1.10 as well as sklearn 0.17
Can you please guide me how to install these?
The best way to do this is by using a custom conda environment. You can do this by either of the following:
install the full version of Anaconda (the current version with Python 3.7)
install Miniconda for a much smaller download
Then open Anaconda Prompt in the Windows start menu. Then do:
conda create -n customenvname python=3.5 numpy=1.10 scikit-learn=0.17
Follow the prompts.
To activate the new environment and get off and running, just do conda activate customenvname. You are now in a Python 3.5 environment with all the dependencies you need:
(base) C:\Users\user>conda activate customenvname
(customenvname) C:\Users\user>python --version
Python 3.5.6 :: Anaconda, Inc.
(customenvname) C:\Users\user>conda list
# packages in environment at C:\Users\user\Miniconda3\envs\customenvname:
#
# Name Version Build Channel
blas 1.0 mkl
certifi 2018.8.24 py35_1
mkl 11.3.3 1
numpy 1.10.4 py35_2
pip 10.0.1 py35_0
python 3.5.6 he025d50_0
scikit-learn 0.17.1 np110py35_1
scipy 0.17.1 np110py35_1
setuptools 40.2.0 py35_0
vc 14.1 h0510ff6_4
vs2015_runtime 14.15.26706 h3a45250_0
wheel 0.31.1 py35_0
wincertstore 0.2 py35hfebbdb8_0
NOTE: the mkl package is an optimization of some of the most used scientific computing libraries maintained by anaconda.

Can someone help me in installing python package "Prophet" on windows 10

Can someone help me in installing python package "Prophet" on windows 10 .
I tried installing python 3.5 and the dependency 'pystan' but yet I get below error.
"The package setup script has attempted to modify files on your system that are not within the EasyInstall build area, and has been aborted.This package cannot be safely installed by EasyInstall, and may not support alternate installation locations even if you run its setup script by hand.Please inform the package's author and the EasyInstall maintainers to find out if a fix or workaround is available.
Command "python setup.py egg_info" failed with error code 1 in c:\users\suman\appdata\local\temp\pip-build-aqoiqs\fbprophet\"`
I spent a good two days on this issue, finally, I found the following solution
1) Download and install Anaconda 3 (for python 3.6)
2) Create an environment and call it whatever you like
3) Run that environment (which will open the command prompt)
4) follow the following steps in command prompt : (commands are shown in bold)
python -m pip install -U pip
Requirement already up-to-date: pip in c:\users\william\anaconda3\envs\testtime\lib\site-packages
conda install -c conda-forge pystan
Fetching package metadata ...............
Solving package specifications: .
Package plan for installation in environment C:\Users\William\Anaconda3\envs\Testtime:
The following NEW packages will be INSTALLED:
backports: 1.0-py36_1 conda-forge
backports.functools_lru_cache: 1.4-py36_1 conda-forge
ca-certificates: 2017.11.5-0 conda-forge
cycler: 0.10.0-py36_0 conda-forge
cython: 0.27.3-py36_0 conda-forge
freetype: 2.7-vc14_1 conda-forge [vc14]
icc_rt: 2017.0.4-h97af966_0
icu: 58.2-vc14_0 conda-forge [vc14]
intel-openmp: 2018.0.0-hd92c6cd_8
jpeg: 9b-vc14_2 conda-forge [vc14]
libpng: 1.6.34-vc14_0 conda-forge [vc14]
matplotlib: 2.1.0-py36_0 conda-forge
mkl: 2018.0.1-h2108138_4
numpy: 1.13.3-py36ha320f96_0
openssl: 1.0.2m-vc14_0 conda-forge [vc14]
pyparsing: 2.2.0-py36_0 conda-forge
pyqt: 5.6.0-py36_4 conda-forge
pystan: 2.17.0.0-py36_vc14_0 conda-forge [vc14]
python-dateutil: 2.6.1-py36_0 conda-forge
pytz: 2017.3-py_2 conda-forge
qt: 5.6.2-vc14_1 conda-forge [vc14]
sip: 4.18-py36_1 conda-forge
six: 1.11.0-py36_1 conda-forge
tornado: 4.5.2-py36_0 conda-forge
zlib: 1.2.11-vc14_0 conda-forge [vc14]
pip install fbprophet
I also had several issues installing prophet on my Windows 10 machine using conda and Python 3.7.
The following steps made it work:
Create a fresh conda environment
Install pystan and other dependencies using conda install numpy cython matplotlib scipy pandas -c conda-forge (see https://pystan2.readthedocs.io/en/latest/windows.html#steps)
Install prophet using conda install prophet -c conda-forge
In then still had a numpy error Importing the numpy c-extensions failed... as described here: https://numpy.org/devdocs/user/troubleshooting-importerror.html But this was due to my IDE which is VS Code as I could successfully run my prohet model using the command line with the activated conda environment.
So please also make sure to test the installation from the command line in order to rule out that the error stems from you IDE.
Not sure if the same trick would work on Windows, anyways posting w.r.t what just worked on RHEL 7, f.w.i.w
Motivation was installing fbprophet using conda:
conda install -c conda-forge fbprophet
and, it could install pystan==2.17.1.0 and fbprophet==0.6
So, the trick was:
uninstall the pystan package when you had earlier run pip3 install fbprophet, basically one needs to execute the following:
pip3 install pystan==2.17.1.0
pip3 install fbprophet==0.6
And one can thereby import fbprophet in python3 terminal, so working :)
I currently have a fairly vanilla install of Python 3.5 on my Windows 10 machine that I setup using Anaconda.
I was able to install Prophet using the below command, that might work for you. Depending on how your installed Python you may need to run the below command in a cmd shell that was opened as administrator.
pip install prophet
Whenever I have tried to install fbprophet package multiple issues have come.I will suggest a few steps, hopefully they should work.
Close all existing Python / R running instances. If possible restart the machine. I have seen to work as few libraries / dependencies which I want to update might be getting used by existing running instances.
Use anaconda prompt.
First install pystan -
`conda install pystan`
Now install fbprophet
'conda install -c conda-forge fbprophet
Hopefully it should work for you. Also, ensure you have admin rights.
I faced the same issue and my solution was to:-
Create a new environment with Python3.5
conda create -n pht python=3.5 anaconda
Install Prophet using the command.
conda install -c conda-forge fbprophet
I didn't install 'gcc' although this was advised before installing Prophet.

Resources