Set up anaconda interpreter in PyCharm on Windows - python

I have anaconda 3 and tensorflow set up and they work well from the anaconda command line. I would like to use PyCharm but cannot add the interpreter Conda.
I followed the instructions from:
https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html
I tried different things. The first is where the conda executable is anaconda.exe:
C:\Logiciels\Anaconda3\Scripts\anaconda.exe create -p C:\Logiciels\Anaconda3\envs\Ex_Files_TensorFlow -y python=3.7
I obtain the error:
anaconda: error: argument : invalid choice: 'create' (choose from 'auth', 'label', 'channel', 'config', 'copy', 'download', 'groups', 'login', 'logout', 'move', 'notebook', 'package', 'remove', 'search', 'show', 'upload', 'whoami')
I tried the conda.exe as executable:
C:\Logiciels\Anaconda3\Scripts\conda.exe create -p C:\Logiciels\Anaconda3\envs\Ex_Files_TensorFlow -y python=3.5
But obtain the output:
Collecting package metadata: ...working... failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/r/noarch/repodata.json.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file a support request with your network engineering team.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/r/noarch/repodata.json.bz2 (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))
I also tried:
C:\Logiciels\Anaconda3\python.exe create -p C:\Users\hel\.conda\envs\Ex_Files_TensorFlow -y python=3.7
The command output is then:
C:\Logiciels\Anaconda3\python.exe: can't open file 'create': [Errno 2] No such file or directory
But the file exists and is there. Why PyCharm doesn't see it?
I also tried version 3.5 instead of 3.7 and a different folder to set the environment in. Do you have any suggestions?

As suggested in the comments, I looked for existing environement in the conda prompt with the command:
conda info --envs
that returns environement presents on the machine
And copy the path to the interpreter field in Add Interpreter > Conda > Existing Environment > Interpreter

I found my conda.exe buried in folder
C:\Users\MYUSER\AppData\Local\Continuum\anaconda3\Scripts

Related

Why does conda look for a package in a channel not listed in the .condarc file?

I am struggling to install packages on Win10 computer where I have no admin privileges and I have restricted access to the Internet throughout our corporate infrastructure. I have Python 3.6 with couple of other packages installed and I'd like clone the environment to do some experiments. As I must install packages only from the repository of the corporate, I have added the following line to the condarc file placed in my %userprofile% directory:
ssl_verify: false
channels:
- https://uname:password#corporateURL/repository/type
Now if I try to clone the base environment with conda create --clone base --name exp_env, it gets all the packages except one, downloading and extracting packages shows 0% at that packege, and tells me that
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/pckname-version-pyversion.tar.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
However, I am able to download that package with my browser from the Internet and from the repository fo the corporate too.
Why does conda look for that package outside the channel I gave to it in the .condarc file?
Why cannot conda download that package even I can download it with my browser?
How to solve the problem by
telling conda to use the repository of the corporate
Downloading the package manually and feed conda with that file?
Additional info
I masked out some of the irrelevant info, but these are the things conda tells:
(base) %userprofile%>conda info
active environment : base
active env location : %ProgramFiles%\Anaconda3
shell level : 1
user config file : %userprofile%\.condarc
populated config files : %userprofile%\.condarc
conda version : X
conda-build version : T
python version : Z.final.0
base environment : %ProgramFiles%\Anaconda3 (read only)
channel URLs : https://user:password#corporateURL/repository/type/win-64
https://user:password#corporateURL/repository/type/noarch
https://user:password#www.corporateURL/repository/type2/win-64
https://user:password#www.corporateURL/repository/type2/noarch
https://user:password#corporateURL/repository/type3/win-64
https://user:password#corporateURL/repository/type3/noarch
package cache : %ProgramFiles%\Anaconda3\pkgs
%userprofile%\AppData\Local\conda\conda\pkgs
envs directories : %userprofile%\AppData\Local\conda\conda\envs
%ProgramFiles%\Anaconda3\envs
%userprofile%\.conda\envs
platform : win-64
user-agent : conda/X requests/Y CPython/Z Windows/10 Windows/S
administrator : False
netrc file : None
offline mode : False

Not able to update conda environment

I am getting following error while updating conda environment.
command:
conda update setuptools
Conda not able to download pywavelets-1.1.1.
getting below error:
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/pywavelets-1.1.1-py37he774522_0.tar.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
Other packages are getting downloaded properly
Issue resolved with following steps:
1. reinstalled Anaconda
2. create condarc file with following content in it.
proxy_servers:
http: http://username:password#proxy:8080
https: https://username:password#proxy:8080
ssl_verify: false
channels:
- defaults
report_errors: false

JupyterLab build is suggested and successfully installed, but will not work. Why?

I'm running JupyterLab from Anaconda, and installed a JupyterLab plotly extension using:
conda install -c conda-forge jupyterlab-plotly-extension
Apparently, the installation was successful, but something is still wrong.
When launching JuyterLab, I'm getting this prompt:
Clicking BUILD gives me this:
And clicking RELOAD relods JupyterLab, BUT I'm getting this again:
And on and on it spins. Does anyone know why?
Clicking CANCEL does not help either because plotly won't produce any plots, only blank spaces:
Solution:
Deactivate firewall and run the following command in a windows command prompt:
jupyter lab build
The details:
This turned out to be a firewall problem, and I'm not sure why it would not be prompted as such in the JupyterLab interface. The following command in a windows command prompt returned the error message below:
Command:
jupyter lab build
Output:
C:>jupyter labextension list JupyterLab v0.34.9 Known labextensions:
app dir:
C:\Users*******\AppData\Local\Continuum\anaconda3\share\jupyter\lab
#jupyterlab/plotly-extension v0.18.2 enabled ok
Build recommended, please run jupyter lab build:
#jupyterlab/plotly-extension needs to be included in build
C:>jupyter lab build [LabBuildApp] JupyterLab 0.34.9 [LabBuildApp]
Building in
C:\Users*******\AppData\Local\Continuum\anaconda3\share\jupyter\lab
[LabBuildApp] > node
C:\Users*******\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab\staging\yarn.js
install yarn install v1.9.4 info No lockfile found. [1/4] Resolving
packages... error An unexpected error occurred:
"https://registry.yarnpkg.com/#jupyterlab%2fapplication: self signed
certificate in certificate chain". info If you think this is a bug,
please open a bug report with the information provided in
"C:\Users\*******\AppData\Local\Continuum\anaconda3\share\jupyter\lab\staging\yarn-error.log".
What pointed me towards suspecting a firewall problem was this part:
self signed certificate in certificate chain
Running the same command on less rigid fire-wall settings triggers this output (shortened):
WARNING in d3-array Multiple versions of d3-array found:
1.2.4 ./~/d3-scale/~/d3-array from ./~/d3-scale/~/d3-array\src\index.js
2.2.0 ./~/d3-array from ./~/d3-array\src\index.js
Check how you can resolve duplicate packages:
https://github.com/darrenscerri/duplicate-package-checker-webpack-plugin#resolving-duplicate-packages-in-your-bundle
Child html-webpack-plugin for "index.html":
1 asset
Entrypoint undefined = index.html
[KTNU] ./node_modules/html-loader!./templates/partial.html 567 bytes {0} [built]
[YuTi] (webpack)/buildin/module.js 497 bytes {0} [built]
[aS2v] ./node_modules/html-webpack-plugin/lib/loader.js!./templates/template.html
1.22 KiB {0} [built]
[yLpj] (webpack)/buildin/global.js 489 bytes {0} [built]
+ 1 hidden module
And despite some warning messages, JupyterLab now produces plotly figures without any problems:

Provisioning CoreOS with Ansible pip error

I am trying to provision a coreOS box using Ansible. First a bootstapped the box using https://github.com/defunctzombie/ansible-coreos-bootstrap
This seems to work ad all but pip (located in /home/core/bin) is not added to the path. In a next step I am trying to run a task that installs docker-py:
- name: Install docker-py
pip: name=docker-py
As pip's folder is not in path I did it using ansible:
environment:
PATH: /home/core/bin:$PATH
If I am trying to execute this task I get the following error:
fatal: [192.168.0.160]: FAILED! => {"changed": false, "cmd": "/home/core/bin/pip install docker-py", "failed": true, "msg": "\n:stderr: /home/core/bin/pip: line 2: basename: command not found\n/home/core/bin/pip: line 2: /root/pypy/bin/: No such file or directory\n"}
what I ask is where does /root/pypy/bin/ come from it seems this is the problem. Any idea?
You can't use shell-style variable expansion when setting Ansible variables. In this statement...
environment:
PATH: /home/core/bin:$PATH
...you are setting your PATH environment variable to the literal value /home/core/bin:$PATH. In other words, you are blowing away any existing value of $PATH, which is why you're getting "command not found" errors for basic things like basename.
Consider installing pip somewhere in your existing $PATH, modifying $PATH before calling ansible, or calling pip from a shells cript:
- name: install something with pip
shell: |
PATH="/home/core/bin:$PATH"
pip install some_module
The problem lies in /home/core/bin/pip script which is literally:
#!/bin/bash
LD_LIBRARY_PATH=$HOME/pypy/lib:$LD_LIBRARY_PATH $HOME/pypy/bin/$(basename $0) $#
when run under root by ansible the $HOME variable is substituted with /root and not with /home/core.
Change $HOME with /home/core and it should work.

error: cannot locate an Oracle software installation

I'm working on Plone.
PRELUDE
I've installed:
oracle-instantclient12.1-basic-12.1.0.1.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.1.0-1.x86_64.rpm
oracle-instantclient12.1-sqlplus-12.1.0.1.0-1.x86_64.rpm
and also cx_Oracle.
I've tested the installations and it's all ok: db connection successfully.
echo $ORACLE_HOME
/usr/lib/oracle/12.1/client64
echo $TNS_ADMIN
/usr/lib/oracle/12.1/client64/admin
echo $LD_LIBRARY_PATH
/usr/lib/oracle/12.1/client64/lib
THE PROBLEM
I've edited buildout.cfg as follows:
[...]
eggs =
Plone
Pillow
collective.documentviewer
Products.OpenXml
Products.AROfficeTransforms
tus
wildcard.foldercontents==2.0a7
**cx_Oracle**
[...]
I receive this error:
Unused options for buildout: 'environment-vars'.
Installing instance.
Getting distribution for 'cx-Oracle'.
error: cannot locate an Oracle software installation
An error occurred when trying to install cx-Oracle 5.1.3. Look above this message for any errors that were output by easy_install.
While:
Installing instance.
Getting distribution for 'cx-Oracle'.
Error: Couldn't install: cx-Oracle 5.1.3
I have no idea how to solve this.
"cannot locate an Oracle software installation" How to fix this?
Got the same problem, background is:
echo $ORACLE_HOME
/usr/lib/oracle/12.1/client64
But:
sudo env | grep ORACLE_HOME
yields nothing.
The solution:
sudo visudo
Then add the line :
Defaults env_keep += "ORACLE_HOME"
As found here
You must be sure that the right envvars are setted for the user that run the Plone instance.
The best way is to add those vars in the buildout configuration::
[buildout]
...
[instance]
...
environment-vars =
...
LD_LIBRARY_PATH /usr/lib/oracle/10.2.0.3/client64/lib
ORACLE_HOME /usr/lib/oracle/10.2.0.3/client64
(This is what I have on a CentOS installation)

Categories

Resources