Created
December 27, 2018 14:53
-
-
Save bombs-kim/c9848c2b09962f2fd753b48b6d2cd87f to your computer and use it in GitHub Desktop.
How to install a custom python binary(ex. python-dbg) in your conda environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This instruction is for Unix-like OS users. | |
# I refered to the following guide when I wrote it. | |
# https://conda.io/docs/user-guide/tasks/build-packages/recipe.html | |
# Activate an environment if needed | |
conda activate myenv | |
# Install conda-build if you haven't. Ironically, installing conda-build | |
# includes installing python. This python will be effectively replaced with | |
# your new python binary so don't worry. | |
conda install conda-build | |
# Make a directory. You can give it any name. | |
mkdir python-dbg | |
cd python-dbg | |
# Download example files(meta.yaml, build.sh) from | |
# https://github.com/conda/conda-recipes | |
wget https://raw.githubusercontent.com/conda/conda-recipes/master/python/python-3.5/meta.yaml | |
wget https://raw.githubusercontent.com/conda/conda-recipes/master/python/python-3.5/build.sh | |
# Modify the downloaded files. You change them to build a different version of | |
# Python or to add compile flags. Refer to Python developer's guide to learn | |
# more about build options. https://devguide.python.org/setup/ | |
# For example, you can make following changes in build.sh | |
# | |
# ./configure --enable-shared --enable-ipv6 --prefix=$PREFIX --with-pydebug | |
# make -j16 | |
cd .. | |
# Hope that the build will succeed or you have to figure out | |
# how to solve the build problem on your own. | |
conda-build python-dbg | |
# When conda build is finished, read the log message carefully and find | |
# the package filename and location. In my case, it looked as below | |
# ..../conda-bld/linux-64/python-3.5.0b4-0.tar.bz2 | |
# This is what's called a package in conda | |
# Actually install the package | |
# This part is not documented well in the official conda tutorial so I | |
# figured it out by reading `conda install -h` message. I'm not sure if | |
# this is the official way to install, but it worked for me. | |
conda install --use-local ..../conda-bld/linux-64/python-3.5.0b4-0.tar.bz2 | |
# Make sure if python has been installed | |
conda list | grep python | |
# Make sure a python-with-pydebug(ex. python3.5dm) was installed along with | |
# a normal python(ex. python3.5m) | |
which python3.5 | |
which python3.5dm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey Beomsoo, I'm trying to get this configuration working and I think I'm close, but having some issues that I wanted try to get your input on. I think I manage to compile Python with debug on Conda's end, but when I run
cygdb
in the directory of a properly compiled library, I getAny pointers on how to solve this? Thanks in advance!