#StackBounty: #python #anaconda #conda #spyder How to install a conda environment with Spyder and Python 2.7?

Bounty: 200

SOmething as simple as:

conda create -n py2 python=2.7

and then in that environment

conda install spyder=3

fails to solve for the environment. Although the only things here are python=2.7 basics and spyder=3, which on their own website specifies requires python 2.7
https://www.psych.mcgill.ca/labs/mogillab/anaconda2/lib/python2.7/site-packages/spyder/doc/installation.html#requirements

Why does this fail, and how can one get something that basic to work?

New attempts: (Last one are specific versions that I know work together, as I have them on my main system wide install).

conda create -n py2 python=2.7 spyder                    --> Fails to solve env

conda create -n py2 python=2.7 spyder -c free            --> installs spyder4

conda create -n py2 python=2.7 spyder=3 -c free          --> AttributeError on launch

conda create -n py2 python=2.7.17 spyder=3.2.3 -c free   --> AttributeError on launch

All fail. If I don’t specify spyder=3, conda installs spyder=4, which is a no-go as those versions of python and spyder do not work together (why doesn;t conda know this when checking for compatibility?). When specifying spyder=3, environment fails to solve except when using channel free, as kindly suggested in the comments. But this method also fails when launching Spyder, throwing AttributeErrors.


Get this bounty!!!

#StackBounty: #python #r #installation #anaconda #reticulate Problems in configuration/installation with reticulate [R]

Bounty: 50

I’m trying to work with reticulate for integrating Python modules inside R and, despite following the tutorial (miniconda is already installed), nothing seems to work properly. I tried with the default way and specifying conda and virtual environments:

> library(reticulate)
> py_config()
# python:         C:/Users/juanj/AppData/Local/r-miniconda/envs/r-reticulate/python.exe
# libpython:      C:/Users/juanj/AppData/Local/r-miniconda/envs/r-reticulate/python36.dll
# pythonhome:     C:/Users/juanj/AppData/Local/r-miniconda/envs/r-reticulate
# version:        3.6.12 (default, Dec  9 2020, 00:11:44) [MSC v.1916 64 bit (AMD64)]
# Architecture:   64bit
# numpy:          C:/Users/juanj/AppData/Local/r-miniconda/envs/r-reticulate/Lib/site-packages/numpy
# numpy_version:  1.19.2

> py_install("python-igraph")
# Collecting package metadata (current_repodata.json): ...working... done
# Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
# Solving environment: ...working... failed with repodata from current_repodata.json, will retry with next repodata source.
# Collecting package metadata (repodata.json): ...working... done
# Solving environment: ...working... done
# 
# ## Package Plan ##
# 
#   environment location: C:UsersjuanjAppDataLocalr-minicondaenvsr-reticulate
# 
#   added / updated specs:
#     - python
#     - python-igraph
# [...]
# python-igraph-0.8.3  | 1.4 MB    | ########## | 100% 
# Preparing transaction: ...working... done
# Verifying transaction: ...working... done
# Executing transaction: ...working... done

> py_module_available("python-igraph")
# [1] FALSE

## virtual environment
> virtualenv_create("r-reticulate")
# Using Python: C:/Users/juanj/AppData/Local/r-miniconda/envs/r-reticulate/python.exe
# Creating virtual environment "r-reticulate" ... Done!
# Installing packages: "pip", "wheel", "setuptools", "numpy"
# Collecting pip
# [...]
# Successfully installed numpy-1.19.5 pip-21.0.1 setuptools-53.0.0 wheel-0.36.2
# Virtual environment 'r-reticulate' successfully created.

> virtualenv_install("r-reticulate", "python-igraph")
# Using virtual environment "r-reticulate" ...
# Collecting python-igraph
#   Downloading python_igraph-0.8.3-cp36-cp36m-win_amd64.whl (1.4 MB)
# Collecting texttable>=1.6.2
#   Downloading texttable-1.6.3-py2.py3-none-any.whl (10 kB)
# Installing collected packages: texttable, python-igraph
# Successfully installed python-igraph-0.8.3 texttable-1.6.3

> py_module_available("python-igraph")
# [1] FALSE

## conda
> conda_create("r-reticulate.conda")
# Collecting package metadata (current_repodata.json): ...working... done
# Solving environment: ...working... done
# 
# ## Package Plan ##
# 
#   environment location: C:UsersjuanjAppDataLocalR-MINI~1envsr-reticulate.conda
# [...]
# Preparing transaction: ...working... done
# Verifying transaction: ...working... done
# Executing transaction: ...working... done
# #
# # To activate this environment, use
# #
# #     $ conda activate r-reticulate.conda
# #
# # To deactivate an active environment, use
# #
# #     $ conda deactivate
# 
# [1] "C:\Users\juanj\AppData\Local\r-miniconda\envs\r-reticulate.conda\python.exe"

> conda_install("r-reticulate.conda", "python-igraph")
# Collecting package metadata (current_repodata.json): ...working... done
# Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
# Solving environment: ...working... failed with repodata from current_repodata.json, will retry with next repodata source.
# Collecting package metadata (repodata.json): ...working... done
# Solving environment: ...working... done
# 
# ## Package Plan ##
# 
#   environment location: C:UsersjuanjAppDataLocalR-MINI~1envsr-reticulate.conda
# [...]
# python-igraph-0.8.3  | 1.4 MB    | ########## | 100% 
# Preparing transaction: ...working... done
# Verifying transaction: ...working... done
# Executing transaction: ...working... done

> py_module_available("python-igraph")
# [1] FALSE

Any idea what I’m missing, please? Thanks.


Get this bounty!!!

#StackBounty: #python #google-drive-api #anaconda #google-authentication #pydrive PyDrive 2.0 – AuthenticationError: No code found in r…

Bounty: 200

Set-up

I’m using PyDrive 2.0 to connect to the Google Drive API.

def connect_google_drive_api():
        
    # use Gdrive API to access Google Drive
    from pydrive2.auth import GoogleAuth
    from pydrive2.drive import GoogleDrive
    
    gauth = GoogleAuth()
    gauth.LocalWebserverAuth() # client_secrets.json need to be in the same directory as the script    
    
    drive = GoogleDrive(gauth)
    
    return drive

The working directory /Users/mypath/access_google_drive contains the client_secrets.json, which looks like,

{"web":{"client_id":"xxx","project_id":"invoice-creation-290413","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"xxx","redirect_uris":["http://localhost:8080/"],"javascript_origins":["http://localhost:8080"]}}

where I replaced the real client_id and client_secret with xxx.


Issue

When the browser (Safari 14.0) shows Gdrive api link wants to access your Google Account and I click Allow, the process seems to be stuck.

After 20 seconds or so, the following error is shown,

Failed to find "code" in the query parameters of the redirect.
Try command-line authentication
Traceback (most recent call last):

  File "<ipython-input-36-792f41ab7318>", line 1, in <module>
    gauth.LocalWebserverAuth()

  File "/opt/anaconda3/lib/python3.7/site-packages/pydrive2/auth.py", line 125, in _decorated
    code = decoratee(self, *args, **kwargs)

  File "/opt/anaconda3/lib/python3.7/site-packages/pydrive2/auth.py", line 273, in LocalWebserverAuth
    raise AuthenticationError("No code found in redirect")

AuthenticationError: No code found in redirect

How do I solve this?


Get this bounty!!!

#StackBounty: #python #anaconda #jupyter-notebook I can not get Jupyter Notebook to work on Linux?

Bounty: 100

I have been trying to get jupyter notebook to launch from the anaconda navigator and the terminal and it will not load. I can start it just fine using the terminal or the navigator but when it opens up on my browser all that I get is a landing page as below:

image of error page

The terminal out put after executing the jupyter notebook command is included below. Any help would be appreciated. I have tried uninstalling and re installing anaconda as well as uninstalling and re installing the jupyter notebook package but neither has resolved the issue.

base) jrbarboza08@penguin:~$ jupyter notebook
[I 17:54:20.508 NotebookApp] The port 8888 is already in use, trying another port.
[I 17:54:20.509 NotebookApp] The port 8889 is already in use, trying another port.
[I 17:54:20.509 NotebookApp] The port 8890 is already in use, trying another port.
[I 17:54:20.509 NotebookApp] The port 8891 is already in use, trying another port.
[I 17:54:20.510 NotebookApp] The port 8892 is already in use, trying another port.
[I 17:54:20.552 NotebookApp] JupyterLab extension loaded from /home/jrbarboza08/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 17:54:20.552 NotebookApp] JupyterLab application directory is /home/jrbarboza08/anaconda3/share/jupyter/lab
[I 17:54:20.554 NotebookApp] Serving notebooks from local directory: /home/jrbarboza08
[I 17:54:20.554 NotebookApp] The Jupyter Notebook is running at:
[I 17:54:20.554 NotebookApp] http://localhost:8955/?token=97c1910620b824478c5a3e2f75c42aa1a731a11785efe9e8
[I 17:54:20.554 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 17:54:20.648 NotebookApp] 

    To access the notebook, open this file in a browser:
        file:///run/user/1000/jupyter/nbserver-6247-open.html
    Or copy and paste one of these URLs:
        http://localhost:8955/?token=97c1910620b824478c5a3e2f75c42aa1a731a11785efe9e8


Get this bounty!!!

#StackBounty: #python #python-3.x #keras #anaconda #conda anaconda prompt always start with these set of commands upon launch after ins…

Bounty: 50

I am using anaconda 2018.2 on Windows 10. After installing keras using conda on “Anaconda Prompt”, I encounter a weird problem. Whenever “Anaconda Prompt” is launched, it executes a set of commands automatically. Whenever any conda command is run, it also runs the same set of commands.

How do I remove this set of irritating commands from “Anaconda Prompt”? Thank you.

The commands look like this as shown below;

C:WINDOWSsystem32>python C:ProgramDataAnaconda3_2018_2etckerasload_config.py  1>temp.txt

C:WINDOWSsystem32>set /p KERAS_BACKEND= 0<temp.txt

C:WINDOWSsystem32>del temp.txt

C:WINDOWSsystem32>python -c "import keras"  1>nul 2>&1

C:WINDOWSsystem32>if errorlevel 1 (
ver  1>nul
 set "KERAS_BACKEND=theano"
 python -c "import keras"  1>nul 2>&1
)

C:WINDOWSsystem32>SET DISTUTILS_USE_SDK=1

C:WINDOWSsystem32>SET MSSdk=1

C:WINDOWSsystem32>SET platform=

C:WINDOWSsystem32>IF /I [AMD64] == [amd64] set "platform=true"

C:WINDOWSsystem32>IF /I [] == [amd64] set "platform=true"

C:WINDOWSsystem32>if defined platform (set "VSREGKEY=HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftVisualStudio14.0" )  ELSE (set "VSREGKEY=HKEY_LOCAL_MACHINESOFTWAREMicrosoftVisualStudio14.0" )

C:WINDOWSsystem32>for /F "skip=2 tokens=2,*" %A in ('reg query "HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftVisualStudio14.0" /v InstallDir') do SET "VSINSTALLDIR=%B"
ERROR: The system was unable to find the specified registry key or value.

C:WINDOWSsystem32>if "" == "" (set "VSINSTALLDIR=C:Program Files (x86)Microsoft Visual Studio 14.0Common7Tools" )

C:WINDOWSsystem32>if "C:Program Files (x86)Microsoft Visual Studio 14.0Common7Tools" == "" (
ECHO "Did not find VS in registry or in VS140COMNTOOLS env var - exiting"
 exit 1
)

C:WINDOWSsystem32>echo "Found VS2014 at C:Program Files (x86)Microsoft Visual Studio 14.0Common7Tools"
"Found VS2014 at C:Program Files (x86)Microsoft Visual Studio 14.0Common7Tools"

C:WINDOWSsystem32>SET "VS_VERSION=14.0"

C:WINDOWSsystem32>SET "VS_MAJOR=14"

C:WINDOWSsystem32>SET "VS_YEAR=2015"

C:WINDOWSsystem32>set "MSYS2_ARG_CONV_EXCL=/AI;/AL;/OUT;/out"

C:WINDOWSsystem32>set "MSYS2_ENV_CONV_EXCL=CL"

C:WINDOWSsystem32>set "PY_VCRUNTIME_REDIST=vcruntime140.dll"

C:WINDOWSsystem32>set "CFLAGS= -MD -GL"

C:WINDOWSsystem32>set "CXXFLAGS= -MD -GL"

C:WINDOWSsystem32>set "LDFLAGS_SHARED= -LTCG ucrt.lib"

C:WINDOWSsystem32>IF /I [] == [win-64] (set "folder=x64" )  else (set "folder=x86" )

C:WINDOWSsystem32>for /F "tokens=*" %I in ('dir "C:Program Files (x86)Windows Kits*1*" /B /O:N') do for %A in (%~I) do if "%A" == "8.1" set win=%A

C:WINDOWSsystem32>for %A in (10) do if "%A" == "8.1" set win=%A

C:WINDOWSsystem32>if "10" == "8.1" set win=10

C:WINDOWSsystem32>for %A in (8.1) do if "%A" == "8.1" set win=%A

C:WINDOWSsystem32>if "8.1" == "8.1" set win=8.1

C:WINDOWSsystem32>for /F "tokens=*" %I in ('dir "C:Program Files (x86)Windows Kits*1*" /B /O:N') do for %A in (%~I) do if "%A" == "10" set win=%A

C:WINDOWSsystem32>for %A in (10) do if "%A" == "10" set win=%A

C:WINDOWSsystem32>if "10" == "10" set win=10

C:WINDOWSsystem32>for %A in (8.1) do if "%A" == "10" set win=%A

C:WINDOWSsystem32>if "8.1" == "10" set win=8.1

C:WINDOWSsystem32>setlocal enabledelayedexpansion

C:WINDOWSsystem32>if "10" == "10" (
for /F "tokens=*" %I in ('dir "C:Program Files (x86)Windows Kits10bin10*" /B /O:N') do for %A in (%~I) do set last=%A
 set "sdk_bin_path=C:Program Files (x86)Windows Kits10bin!last!x86"
)  else (set "sdk_bin_path=C:Program Files (x86)Windows Kits8.1binx86" )

C:WINDOWSsystem32>for %A in (10.0.14393.0) do set last=%A

C:WINDOWSsystem32>set last=10.0.14393.0

C:WINDOWSsystem32>for %A in (10.0.15063.0) do set last=%A

C:WINDOWSsystem32>set last=10.0.15063.0

C:WINDOWSsystem32>for %A in (10.0.16299.0) do set last=%A

C:WINDOWSsystem32>set last=10.0.16299.0

C:WINDOWSsystem32>for %A in (10.0.17134.0) do set last=%A

C:WINDOWSsystem32>set last=10.0.17134.0

C:WINDOWSsystem32>for %A in (10.0.17763.0) do set last=%A

C:WINDOWSsystem32>set last=10.0.17763.0

C:WINDOWSsystem32>endlocal   & set "PATH=C:ProgramDataAnaconda3_2018_2;C:ProgramDataAnaconda3_2018_2Librarymingw-w64bin;C:ProgramDataAnaconda3_2018_2Libraryusrbin;C:ProgramDataAnaconda3_2018_2Librarybin;C:ProgramDataAnaconda3_2018_2Scripts;C:ProgramDataAnaconda3_2018_2bin;C:ProgramDataAnaconda3_2018_2condabin;C:Program Files (x86)Common FilesOracleJavajavapath;C:Program FilesNVIDIA GPU Computing ToolkitCUDAv9.0bin;C:Program FilesNVIDIA GPU Computing ToolkitCUDAv9.0libnvvp;C:Program FilesNVIDIA GPU Computing ToolkitCUDAv9.2bin;C:Program FilesNVIDIA GPU Computing ToolkitCUDAv9.2libnvvp;C:ProgramDataOracleJavajavapath;C:Program FilesMicrosoft MPIBin;C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)PDFtkbin;C:Program Files (x86)Microchipxc8v1.37bin;C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:Program Files (x86)Nordic Semiconductornrf5xbin;C:Program Files (x86)Microchipxc8v1.35bin;C:ProgramDataComposerSetupbin;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Program FilesOracleVirtualBox;C:Program FilesRR-3.3.2binx64;C:Program FilesMicrosoft SQL Server120ToolsBinn;C:Program Filesdotnet;C:Program FilesMicrosoft SQL Server130ToolsBinn;C:WINDOWSSystem32OpenSSH;C:cudnn-9.0-windows10-x64-v7.2.1.38cudabin;C:Program Files (x86)Graphviz2.38bin;C:Program FilesGitcmd;C:Program FilesNVIDIA CorporationNVIDIA NvDLISR;C:ProgramDataAnaconda3;C:ProgramDataAnaconda3Scripts;C:Program Filesnodejs;C:Usersyoung.windows-build-toolspython27;C:UsersyoungAppDataRoamingnpmnode_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin;C:UsersyoungAppDataRoamingnpmnode_moduleswindows-build-toolsnode_modules.bin;C:UsersyoungAppDataRoamingnpmnode_modules.bin;C:UsersyoungDropboxPortableAppsPortableAppsConsolePortableDatascripts;C:Usersyoung.windows-build-toolspython27;C:UsersyoungAppDataRoamingnpmnode_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin;C:UsersyoungAppDataRoamingnpmnode_moduleswindows-build-toolsnode_modules.bin;C:UsersyoungAppDataRoamingnpmnode_modules.bin;C:UsersyoungDropboxPortableAppsPortableAppsConsolePortableDatascripts;C:Program FilesMicrosoft VS Codebin;C:UsersyoungAppDataRoamingComposervendorbin;C:UsersyoungAppDataLocalMicrosoftWindowsApps;C:UsersyoungAppDataLocalGitHubDesktopbin;C:UsersyoungAppDataLocalProgramsMicrosoft VS Codebin;C:UsersyoungAppDataRoamingnpm;C:ProgramDataAnaconda3_2018_2libsite-packagespywin32_system32;C:Program Files (x86)Windows Kits10bin10.0.17763.0x86"

C:WINDOWSsystem32>SET "CMAKE_GENERATOR=Visual Studio 14 2015 Win64"

C:WINDOWSsystem32>CALL "C:Program Files (x86)Microsoft Visual Studio 14.0Common7Tools....VCvcvarsall.bat" amd64


Get this bounty!!!

#StackBounty: #anaconda Conda broken after package uninstall

Bounty: 50

I have created conda environments in the past without any problems. So, even this time I proceeded to create one.
conda create -n astropython anaconda

Next, the documentation recommended uninstalling any previous copies of astropy by running:
conda uninstall astropy
I did that, and now my conda is broken. If I run any command with conda, I get the following error traceback.

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 19, in get_yaml
    import ruamel_yaml as yaml
ModuleNotFoundError: No module named 'ruamel_yaml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 22, in get_yaml
    import ruamel.yaml as yaml
ModuleNotFoundError: No module named 'ruamel'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1062, in __call__
    return func(*args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 74, in _main
    from ..base.context import context
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 28, in <module>
    from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter,
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 40, in <module>
    from .serialize import yaml_load
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 30, in <module>
    yaml = get_yaml()
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/_vendor/auxlib/decorators.py", line 59, in _memoized_func
    result = func(*args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 24, in get_yaml
    raise ImportError("No yaml library available.n"
ImportError: No yaml library available.
To proceed, conda install ruamel_yaml

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 19, in get_yaml
    import ruamel_yaml as yaml
ModuleNotFoundError: No module named 'ruamel_yaml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 22, in get_yaml
    import ruamel.yaml as yaml
ModuleNotFoundError: No module named 'ruamel'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/bin/conda", line 13, in <module>
    sys.exit(main())
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 150, in main
    return conda_exception_handler(_main, *args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1354, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1065, in __call__
    return self.handle_exception(exc_val, exc_tb)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1109, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1120, in handle_unexpected_exception
    self.print_unexpected_error_report(error_report)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1175, in print_unexpected_error_report
    from .base.context import context
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 28, in <module>
    from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter,
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/configuration.py", line 40, in <module>
    from .serialize import yaml_load
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 30, in <module>
    yaml = get_yaml()
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/_vendor/auxlib/decorators.py", line 59, in _memoized_func
    result = func(*args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/common/serialize.py", line 24, in get_yaml
    raise ImportError("No yaml library available.n"
ImportError: No yaml library available.
To proceed, conda install ruamel_yaml

Running conda install ruamel_yaml again spits out the same traceback. My $PATH is correct, solution to No module named ruamel did not solve the issue.

So, I looked into the files and found that there was no ruamel_yaml folder in the site-packages dir. I copied the ruamel_yaml folder from $HOME/anaconda3/pkgs/ruamel_yaml0.15.71/ to $HOME/anaconda3/lib/python3.6/site-packages/. Now, when I run any conda commands, I get the following error:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1062, in __call__
    return func(*args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 84, in _main
    exit_code = do_call(args, p)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 80, in do_call
    module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
  File "/Users/vsanc/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main_update.py", line 8, in <module>
    from .install import install
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 19, in <module>
    from ..core.index import calculate_channel_urls, get_index
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 9, in <module>
    from .package_cache_data import PackageCacheData
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/package_cache_data.py", line 15, in <module>
    from conda_package_handling.api import InvalidArchiveError
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda_package_handling/api.py", line 3, in <module>
    from libarchive.exception import ArchiveError as _LibarchiveArchiveError
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/__init__.py", line 1, in <module>
    from .entry import ArchiveEntry
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/entry.py", line 4, in <module>
    from ctypes import c_char_p, create_string_buffer
  File "/Users/vsanc/anaconda3/lib/python3.6/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libffi.6.dylib
  Referenced from: /Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so
  Reason: image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/vsanc/anaconda3/bin/conda", line 13, in <module>
    sys.exit(main())
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 150, in main
    return conda_exception_handler(_main, *args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1354, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1065, in __call__
    return self.handle_exception(exc_val, exc_tb)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1109, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1120, in handle_unexpected_exception
    self.print_unexpected_error_report(error_report)
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1190, in print_unexpected_error_report
    from .cli.main_info import get_env_vars_str, get_main_info_str
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/cli/main_info.py", line 19, in <module>
    from ..core.index import _supplement_index_with_system
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 9, in <module>
    from .package_cache_data import PackageCacheData
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda/core/package_cache_data.py", line 15, in <module>
    from conda_package_handling.api import InvalidArchiveError
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/conda_package_handling/api.py", line 3, in <module>
    from libarchive.exception import ArchiveError as _LibarchiveArchiveError
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/__init__.py", line 1, in <module>
    from .entry import ArchiveEntry
  File "/Users/vsanc/anaconda3/lib/python3.6/site-packages/libarchive/entry.py", line 4, in <module>
    from ctypes import c_char_p, create_string_buffer
  File "/Users/vsanc/anaconda3/lib/python3.6/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libffi.6.dylib
  Referenced from: /Users/vsanc/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-darwin.so
  Reason: image not found


Get this bounty!!!

#StackBounty: #bash #kickstart #anaconda #variables Kickstart CentOS 7 with pre-defined static IP and hostname (%pre) and used in KS, p…

Bounty: 50

I don’t know if this is possible, but going to ask anyways.

I am trying to Kickstart newer servers of us with CentOS 7. So far I got most working, however for some reason if I use variables in the %pre section of my Kickstart script, then it does not get parsed over to the configuration at all. Therefor I am starting to think this is not even possible?

This is what I have in the %pre section of my Kickstart:

%pre --log /tmp/pre-install.log

hostname=serverA120
ip=100.110.120.130
IFS=. read ip1 ip2 ip3 ip4 <<< "$ip"

Than during the Kickstart it should use the above filled-in information:

network  --bootproto=static --device=eth0 --gateway=100.110.$ip3.1 --ip=$ip --nameserver=1.1.1.1 --netmask=255.255.255.0
network  --hostname=$hostname.example.com

And in the %post section I also try to use the variables from %pre:

sed -i'' -e '/HOSTNAME=/d' /etc/sysconfig/network
echo HOSTNAME=$hostname.example.com >> /etc/sysconfig/network
echo GATEWAY=100.110.$ip3.1 >> /etc/sysconfig/network

echo BOOTPROTO=static >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo IPADDR=$ip >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo NETMASK=255.255.255.0 >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo BROADCAST=100.110.$ip3.255 >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo NETWORK=100.110.$ip3.0 >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo GATEWAY=100.110.$ip3.1  >> /etc/sysconfig/network-scripts/ifcfg-eth0

echo $hostname.example.com >> /etc/hostname
sudo hostnamectl set-hostname $hostname.example.com

I checked the ifcfg-eth0 physically after I couldn’t reach the server anymore and it showed the following:

IPADDR=
BROADCAST=100.110..255
NETWORK=100.110..0
GATEWAY=100.110..1

I also checked /etc/hostname:

$hostname.example.com

So variables are not being parsed into the Kickstart. Am I doing something wrong or is it simply not possible? And is there an alternative solution perhaps for this?

Ofcourse I can manually adjust all lines manually before and after, but I wanted to make this as easy as possible without editing everything manually. In other words, I just want to fill in 2 lines and that rest gets configured as I want. This would make things easier with Kickstarting multiple servers on the long run.

I have no clue what I am doing wrong, but checking ifcfg-eth0 and hostname, it clearly shows the pre-entered variables are not being used? But like I said above, maybe it’s simply not possible, that or I am using it incorrectly.

And no I don’t want to use DHCP or similar. Because I still have to change it manually afterwards. I just want to fill in the first two lines in %pre (hostname and ip) and that it gets used automatically during the complete installation (and in %post).


Get this bounty!!!

#StackBounty: #partition #kickstart #anaconda Kickstart CentOS 7 with software RAID 1, but no LVM needed

Bounty: 50

I am going to Kickstart a CentOS 7.x installation with software RAID 1 remotely for the first time. So I am kinda inexperienced at this and wondering what I need to make this work correctly.

A CentOS 7.x kickstart with hardware raid, I use the following partition configuration:

# Disk partitioning information
part biosboot --fstype=biosboot --size=1
part /boot --fstype=ext4 --size=1024
part / --fstype=ext4 --size=10000
part /vz --fstype=ext4vz --size=40768 --grow
part swap --size=4096

This works very well.

However since I have never ever done a software RAID 1 on CentOS in general, I am wondering what the correct commands are to do so? I did some searching, but most tutorials / information I found on Google is pretty dated or uses LVM (Volume Group), which I don’t want.

I want the exact same thing as I have above, but this time with software RAID 1.

Can someone give me a workable example of how this can be done? And do I need to make changes as well to other aspects of my Kickstart configuration? E.g. bootloader configuration.

Oh and I don’t use EFI. Don’t know if that is important to mention.

Sorry for popping the question. I did search, but couldn’t find any workable information and/or examples to experiement with. And as I said; I am doing this remotely and I don’t have direct access (well unless I drive).

Thanks in advance!

//edit #1

I wanted to give it a go on a local test machine with 2x 120GB SSD’s in software RAID 1. So I went through the CentOS 7.x installer by using this tutorial for the CentOS 7.x installation GUI.

Well after a wait, I rebooted and apparently it was setup correctly:

Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/md127     ext4      9.5G  4.7G  4.4G  52% /
devtmpfs       devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs          tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs          tmpfs     1.9G  9.7M  1.9G   1% /run
tmpfs          tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/md124     ext4       74G   53M   70G   1% /vz
/dev/md125     ext4      488M  149M  305M  33% /boot
tmpfs          tmpfs     379M  4.0K  379M   1% /run/user/42
tmpfs          tmpfs     379M   48K  379M   1% /run/user/1000
tmpfs          tmpfs     379M     0  379M   0% /run/user/0

So since this was setup correctly I decided to take a peak at the anaconda-ks.cfg file. No partition scheme in there. Okay, so I checked the next file “initial-setup-ks.cfg”. Same thing, no partition scheme. Sigh.

I always thought that your current setup, through the installer GUI, was reflected in those files? Wishful thinking apparently. So I am back to scratch again…

//edit #2

Nobody has an idea on how to do this correctly? 🙁


Get this bounty!!!