Installing local packages with Anaconda - python

I am using Anaconda with 64 bit Python 2.7 on a Windows 7 machine that is necessarily isolated from the internet. I am having difficulty installing local packages. Right now I am stuck on PyMySQL, but I imagine I would also have the same problem with other packages. My system PATH variable has Anaconda at the beginning.
Trying a path to the unpacked folder:
conda install –-offline c:\temp\PyMySQL-master\pymysql
PackageNotFoundError: Package missing in current win-64 channels:
- c:\temp\pymysql-master\pymysql
What does this error mean? I have tried using a tar file and I get the same error message. This is the same message I get if I spell the filename wrong, so there is something I am missing to get it to recognize the file. Do I need to create a channel for a local package? How would I do that? Is there anything else I should try?
Here is the response in verbose mode:
conda install --offline --verbose c:\temp\pymysql.tar
Fetching package metadata ...........
An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:
https://github.com/conda/conda/issues
Current conda install:
platform : win-64
conda version : 4.3.21
conda is private : False
conda-env version : 4.3.21
conda-build version : not installed
python version : 2.7.13.final.0
requests version : 2.14.2
root environment : C:\ProgramData\Anaconda2 (writable)
default environment : C:\ProgramData\Anaconda2
envs directories : C:\ProgramData\Anaconda2\envs
C:\Users\lab1\AppData\Local\conda\conda\envs
C:\cygwin\home\lab1\.conda\envs
package cache : C:\ProgramData\Anaconda2\pkgs
C:\Users\lab1\AppData\Local\conda\conda\pkgs
channel URLs : https://repo.continuum.io/pkgs/free/win-64 (offline)
https://repo.continuum.io/pkgs/free/noarch (offline)
https://repo.continuum.io/pkgs/r/win-64 (offline)
https://repo.continuum.io/pkgs/r/noarch (offline)
https://repo.continuum.io/pkgs/pro/win-64 (offline)
https://repo.continuum.io/pkgs/pro/noarch (offline)
https://repo.continuum.io/pkgs/msys2/win-64 (offline)
https://repo.continuum.io/pkgs/msys2/noarch (offline)
config file : C:\cygwin\home\lab1\.condarc
netrc file : None
offline mode : True
user-agent : conda/4.3.21 requests/2.14.2 CPython/2.7.13 Windows/7 Windows/6.1.7601
administrator : True
`$ C:\ProgramData\Anaconda2\Scripts\conda-script.py install --offline --verbose c:\temp\pymysql.tar`
Traceback (most recent call last):
File "C:\ProgramData\Anaconda2\lib\site-packages\conda\exceptions.py", line 632, in conda_exception_handler
return_value = func(*args, **kwargs)
File "C:\ProgramData\Anaconda2\lib\site-packages\conda\cli\main.py", line 137, in _main
exit_code = args.func(args, p)
File "C:\ProgramData\Anaconda2\lib\site-packages\conda\cli\main_install.py", line 80, in execute
install(args, parser, 'install')
File "C:\ProgramData\Anaconda2\lib\site-packages\conda\cli\install.py", line 306, in install
raise PackageNotFoundError(error_message)
PackageNotFoundError: Package missing in current win-64 channels:
- c:\temp\pymysql.tar

Every conda package ever built to date has a .tar.bz2 extension, and this assumption is baked in deeply. Someday we'll probably add different package types, compression algorithms, and extensions, but that's a ways off. So to work, your command needs to be
conda install --offline --verbose c:\temp\pymysql.tar.bz2
and pymysql.tar.bz2 needs to be a real conda package. (i.e. if you unpack that tarball and there's no info/files file in it, then it's not a conda package)

Related

Conda ImporrtError whenever I open a new terminal

[Edit] Added conda info to question.
Something wrong is happening with my conda setup.
From what I remember, I needed the AI gym library for a lab at my university.
I tried to install it using conda install -c akode gym and I was unable to do so. I used a pip install instead.
Since then, I am having the following error whenever I start a new terminal:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ImportError: No module named conda
Conda and all the related software and packages work very fine though.
This is my OS config :
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
This is the output of conda info :
active environment : base
active env location : /home/cnemri/anaconda3
shell level : 1
user config file : /home/cnemri/.condarc
populated config files :
conda version : 4.8.0
conda-build version : 3.18.11
python version : 3.7.5.final.0
virtual packages : __glibc=2.27
base environment : /home/cnemri/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /home/cnemri/anaconda3/pkgs
/home/cnemri/.conda/pkgs
envs directories : /home/cnemri/anaconda3/envs
/home/cnemri/.conda/envs
platform : linux-64
user-agent : conda/4.8.0 requests/2.22.0 CPython/3.7.5 Linux/4.15.0-1065-oem ubuntu/18.04.3 glibc/2.27
UID:GID : 1001:1001
netrc file : None
offline mode : False
How can I not have this error anymore ?
Thank you.
The error has been fixed, I did a conda update conda as advised by #merv and it works very fine. The error disappeared.

"Collecting package metadata: failed" with UnavailableInvalidChannel error when conda install in a brand new Anaconda environment

Just after I successfully installed Anaconda in Windows (using the official installer), I tried to install a package with conda command. Then, I got the following UnavailableInvalidChannel error:
C:\Users\user>conda install numpy
WARNING: The conda.compat module is deprecated and will be removed in a future release.
Collecting package metadata: failed
UnavailableInvalidChannel: The channel is not accessible or is invalid.
channel name: pkgs/msys2/repo.anaconda.com/pkgs
channel url: https://repo.anaconda.com/pkgs/msys2/repo.anaconda.com/pkgs
error code: 404
It seems conda is using wrong channel url, but there is no reference to https://repo.anaconda.com/pkgs/msys2/repo.anaconda.com/pkgs in my config.
C:\Users\user>conda config --show channels
channels:
- https://repo.anaconda.com/pkgs/
- https://repo.anaconda.com/pkgs/main/win-64/
- defaults
Do you have any idea how to resolve this problem?
Here is my environment:
C:\Users\user>conda info
active environment : None
user config file : C:\Users\user\.condarc
populated config files : C:\Users\user\.condarc
conda version : 4.6.11
conda-build version : 3.17.8
python version : 3.7.3.final.0
base environment : C:\ProgramData\Anaconda3 (read only)
channel URLs : https://conda.anaconda.org/conda-forge/win-64
https://conda.anaconda.org/conda-forge/noarch
https://repo.anaconda.com/pkgs/msys2/repo.anaconda.com/pkgs/win-64
https://repo.anaconda.com/pkgs/msys2/repo.anaconda.com/pkgs/noarch
https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
package cache : C:\ProgramData\Anaconda3\pkgs
C:\Users\user\.conda\pkgs
C:\Users\user\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\user\.conda\envs
C:\ProgramData\Anaconda3\envs
C:\Users\user\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.6.11 requests/2.21.0 CPython/3.7.3 Windows/10 Windows/10.0.17763
administrator : False
netrc file : None
offline mode : False

Conda install in offline mode not working

I am trying to install a python package using conda in offline mode. I have to install in offline mode because of the network I am using.
The package I want to install is mlpack, and I am using python3 on a Mac x64 with macOS Sierra 10.12.6. I downloaded mlpack from the Anaconda webstie: https://anaconda.org/ilastik/mlpack
Then I used the command
conda install --offline -c ilastik /anaconda3/tars/mlpack-1.0.8.99-8.tar.bz2
and I receive the following output:
Downloading and Extracting Packages
*-None | | ############################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
When I look in anaconda3/pkgs I can see that a folder was created called mlpack. However, when I try to run import mlpack in Python, it says
import mlpack
Traceback (most recent call last):
File "<ipython-input-4-edcb40cca368>", line 1, in <module>
import mlpack
ModuleNotFoundError: No module named 'mlpack'
I tried adding -vv to the install command and received this:
pn1503563$ conda install --offline -c ilastik /anaconda3/tars/mlpack-1.0.8.99-8.tar.bz2 -vv
DEBUG conda.gateways.logging:set_verbosity(148): verbosity set to 2
DEBUG conda.core.package_cache_data:__init__(549): instantiating ProgressiveFetchExtract with
*[url=file:///anaconda3/tars/mlpack-1.0.8.99-8.tar.bz2]
DEBUG conda.core.package_cache_data:_check_writable(237): package cache directory '/anaconda3/pkgs' writable: True
DEBUG conda.core.package_cache_data:_check_writable(237): package cache directory '/Users/nstegmeier/.conda/pkgs' writable: True
DEBUG conda.core.package_cache_data:_check_writable(237): package cache directory '/anaconda3/pkgs' writable: True
DEBUG conda.core.link:__init__(157): instantiating UnlinkLinkTransaction with
target_prefix: /anaconda3
unlink_precs:
<unknown>::mlpack-1.0.8.99-8
link_precs:
<unknown>::mlpack-1.0.8.99-8
DEBUG conda.core.package_cache_data:__init__(549): instantiating ProgressiveFetchExtract with
<unknown>::mlpack-1.0.8.99-8
Preparing transaction: ...working... DEBUG conda.core.link:_get_python_version(630): found in current prefix python version 3.6
done
Verifying transaction: ...working... done
DEBUG conda.common.signals:signal_handler(43): registering handler for SIGABRT
DEBUG conda.common.signals:signal_handler(43): registering handler for SIGINT
DEBUG conda.common.signals:signal_handler(43): registering handler for SIGTERM
DEBUG conda.common.signals:signal_handler(43): registering handler for SIGQUIT
Executing transaction: ...working... INFO conda.core.link:_execute_actions(542): ===> UNLINKING PACKAGE: <unknown>::mlpack-1.0.8.99-8 <===
prefix=/anaconda3
INFO conda.core.link:_execute_actions(548): ===> LINKING PACKAGE: <unknown>::mlpack-1.0.8.99-8 <===
prefix=/anaconda3
source=/anaconda3/pkgs/mlpack-1.0.8.99-8
done
DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGABRT
DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGINT
DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGTERM
DEBUG conda.common.signals:signal_handler(56): de-registering handler for Signals.SIGQUIT
The command conda info --offline gives
pn1503563$ conda info --offline
active environment : None
user config file : /Users/nstegmeier/.condarc
populated config files : /Users/nstegmeier/.condarc
conda version : 4.5.4
conda-build version : 3.10.5
python version : 3.6.5.final.0
base environment : /anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64 (offline)
https://repo.anaconda.com/pkgs/main/noarch (offline)
https://repo.anaconda.com/pkgs/free/osx-64 (offline)
https://repo.anaconda.com/pkgs/free/noarch (offline)
https://repo.anaconda.com/pkgs/r/osx-64 (offline)
https://repo.anaconda.com/pkgs/r/noarch (offline)
https://repo.anaconda.com/pkgs/pro/osx-64 (offline)
https://repo.anaconda.com/pkgs/pro/noarch (offline)
package cache : /anaconda3/pkgs
/Users/nstegmeier/.conda/pkgs
envs directories : /anaconda3/envs
/Users/nstegmeier/.conda/envs
platform : osx-64
user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Darwin/16.7.0 OSX/10.12.6
UID:GID : 507:20
netrc file : None
offline mode : True
As was pointed out you should use mlpack from the official mlpack repository.
Ilastik channel has a very old version of mlpack without python bindings.
To download all packages required for offline installation run the following command:
conda install -c mlpack -c conda-forge mlpack
After this, you can find all the required packages archives in <condadir>/pkgs
Optionally add ilastik channel (-c ilastik) to this command if you need any packages from it.

Launching Spyder and JupyterNotebook causes importError when image not found

I'm new to python and the virtual environment stuff. I'm facing issues opening jupyter notebook and Spyder after updating conda.
Here are some info about the versions I have:
$ conda info
active environment : None '''is it caused by this ? '''
user config file : /Users/-/.condarc
populated config files : /Users/-/.condarc
conda version : 4.5.4
conda-build version : 3.0.27
python version : 2.7.14.final.0
base environment : /Users/-/anaconda2 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/osx-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/osx-64
https://repo.anaconda.com/pkgs/pro/noarch
package cache : /Users/-/anaconda2/pkgs
/Users/-/.conda/pkgs
envs directories : /Users/-/anaconda2/envs
/Users/-/.conda/envs
platform : osx-64
user-agent : conda/4.5.4 requests/2.18.4 CPython/2.7.14 Darwin/15.5.0 OSX/10.11.5
UID:GID : 501:20
netrc file : None
offline mode : False
JupyerNotebook version : 5.5.0
Jupyter version : 4.4.0
Spyder version : 3.2.8
Spyder fails to launch and when trying to launch spyder from anaconda navigator I get this error:
/anaconda2/lib/python2.7/site-packages/zmq/backend/cython/init.py", line 6, in
from . import (constants, error, message, context,
ImportError: dlopen(/Users/-/anaconda2/lib/python2.7/site-packages/zmq/backend/cython/error.so, 2): Library not loaded: #rpath/libsodium.23.dylib
Referenced from: /Users/-/anaconda2/lib/libzmq.5.dylib
Reason: image not found
Trying to launch jupyter notebook from anaconda throws the same image not found error:
/anaconda2/lib/python2.7/site-packages/zmq/backend/cython/init.py", line 6, in
from . import (constants, error, message, context,
ImportError: dlopen(/Users/-/anaconda2/lib/python2.7/site-packages/zmq/backend/cython/error.so, 2): Library not loaded: #rpath/libsodium.23.dylib
Referenced from: /Users/-/anaconda2/lib/libzmq.5.dylib
Reason: image not found
I found out that after updating, a new Anaconda2 folder was initialized for only the zmq file /anaconda2/lib/python2.7/site-packages/zmq/backend/cffi/__pycache__.
Everything was working smoothly but after following anaconda instructions and recommendations to update I started getting those errors.
How can I resolve this issue? Is it because the active environment : None?
Faced same issue. From https://github.com/jupyter/notebook/issues/1632 it explained that some dependencies when updating conda are messed up so try:
conda remove zeromq
conda install zeromq
Then try:
conda update conda-build
Good luck,

Anaconda Import Error, module just installed isn't found

Yet another Import Error issue, I know...
I have been through many posts on stackoverflow about this issue but nothing seem to help
Here is the thing, I am not a windows person, I have used anaconda on mac and Linux for quite a while but now I have to train someone on Python with windows10.
So I tried to install Anaconda, thinking oh well that should be easy...
What I did :
Install miniconda3
Create a conda environment named 'first' - activated it
Install numpy scipy and geopandas (conda install -c conda-forge geopandas)
Start IPython
Typed import geopandas and got an Import Error ModuleNotFoundError: No module named 'geopandas'
Note that Geopandas and all packages appear in the pip list of my environment
So then I Import sys and typed sys.path with this result (sys.executable was fine)
['',
'C:\\Users\\mine\\Miniconda3\\Scripts',
'C:\\Users\\mine\\Miniconda3\\python36.zip',
'C:\\Users\\mine\\Miniconda3\\DLLs',
'C:\\Users\\mine\\Miniconda3\\lib',
'C:\\Users\\mine\\Miniconda3',
'C:\\Users\\mine\\Miniconda3\\lib\\site-packages',
'C:\\Users\\mine\\Miniconda3\\lib\\site-packages\\win32',
'C:\\Users\\mine\\Miniconda3\\lib\\site-packages\\win32\\lib',
'C:\\Users\\mine\\Miniconda3\\lib\\site-packages\\Pythonwin',
'C:\\Users\\mine\\Miniconda3\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\mine\\.ipython']
I believe I should see something about my conda environment in there
c:\users\mine\miniconda3\envs\first\
What did I do wrong? How do I fix it and why do you think that happened? Should I report it to anaconda as it seems to be a pretty annoying thing.
In case that helps :
(first) C:\Users\mine>conda info -a
active environment : first
active env location : C:\Users\mine\Miniconda3\envs\first
shell level : 2
user config file : C:\Users\mine\.condarc
populated config files :
conda version : 4.4.10
conda-build version : not installed
python version : 3.6.3.final.0
base environment : C:\Users\mine\Miniconda3 (writable)
channel URLs : https://repo.continuum.io/pkgs/main/win-64
https://repo.continuum.io/pkgs/main/noarch
https://repo.continuum.io/pkgs/free/win-64
https://repo.continuum.io/pkgs/free/noarch
https://repo.continuum.io/pkgs/r/win-64
https://repo.continuum.io/pkgs/r/noarch
https://repo.continuum.io/pkgs/pro/win-64
https://repo.continuum.io/pkgs/pro/noarch
https://repo.continuum.io/pkgs/msys2/win-64
https://repo.continuum.io/pkgs/msys2/noarch
package cache : C:\Users\mine\Miniconda3\pkgs
C:\Users\mine\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\mine\Miniconda3\envs
C:\Users\mine\AppData\Local\conda\conda\envs
C:\Users\mine\.conda\envs
platform : win-64
user-agent : conda/4.4.10 requests/2.18.4 CPython/3.6.3 Windows/10 Windows/10.0.16299
administrator : False
netrc file : None
offline mode : False
# conda environments:
#
base C:\Users\mine\Miniconda3
first * C:\Users\mine\Miniconda3\envs\first
sys.version: 3.6.3 |Anaconda, Inc.| (default, Nov 8 ...
sys.prefix: C:\Users\mine\Miniconda3
sys.executable: C:\Users\mine\Miniconda3\python.exe
conda location: C:\Users\mine\Miniconda3\lib\site-packages\conda
conda-build: None
conda-env: C:\Users\mine\Miniconda3\Scripts\conda-env.exe
user site dirs:
CIO_TEST: <not set>
CONDA_DEFAULT_ENV: first
CONDA_PREFIX: C:\Users\mine\Miniconda3\envs\first
CONDA_PREFIX_1: C:\Users\mine\Miniconda3
CONDA_PROMPT_MODIFIER: (first)
CONDA_PYTHON_EXE: C:\Users\mine\Miniconda3\python.exe
CONDA_ROOT: C:\Users\mine\Miniconda3
CONDA_SHLVL: 2
HOMEPATH: \Users\mine
PATH: C:\Users\mine\Miniconda3\envs\first;C:\Users\mine\Miniconda3\envs\first\Library\mingw-w64\bin;C:\Users\mine\Miniconda3\envs\first\Library\usr\bin;C:\Users\mine\Miniconda3\envs\first\Library\bin;C:\Users\mine\Miniconda3\envs\first\Scripts;C:\Users\mine\Miniconda3\envs\first\bin;C:\Users\mine\Miniconda3;C:\Users\mine\Miniconda3\Library\mingw-w64\bin;C:\Users\mine\Miniconda3\Library\usr\bin;C:\Users\mine\Miniconda3\Library\bin;C:\Users\mine\Miniconda3\Scripts;C:\Users\mine\Miniconda3\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\mine\AppData\Local\Microsoft\WindowsApps;
PSMODULEPATH: C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PYTHONIOENCODING: 1252
REQUESTS_CA_BUNDLE: <not set>
SSL_CERT_FILE: <not set>
You also need to install IPython into your new environment:
conda install ipython
otherwise it uses the ipython form "outside" the environment because it is a command line app and not necessary connected to an environment.
You can check IPython you use with:
where ipython

Categories

Resources