I´m a newbie to conda, I only have a very surface-level understanding of how it works.
My objective was to install an annotation software (dammit) using conda.
Conda was installed as follows:
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && bash miniconda.sh -b -p $HOME/miniconda
echo 'export PATH="$HOME/miniconda/bin:$PATH"' >> $HOME/.bashrc
Then I created an environment, set up the channels, and installed my software:
conda create -n dammit python=3
source activate dammit
conda config --add channels defaults
conda config --add channels conda-forge
conda config --add channels bioconda
conda install dammit
When I tried to run the main script an error occurred
Traceback (most recent call last):
File "./dammit", line 5, in <module>
from dammit import app
File "/home/up201505534/miniconda/envs/dammit/lib/python3.6/site-packages/dammit/app.py", line 13, in <module>
from dammit import annotate
File "/home/up201505534/miniconda/envs/dammit/lib/python3.6/site-packages/dammit/annotate.py", line 13, in <module>
from shmlast.app import CRBL
File "/home/up201505534/miniconda/envs/dammit/lib/python3.6/site-packages/shmlast/app.py", line 3, in <module>
from doit.tools import run_once, create_folder
File "/home/up201505534/miniconda/envs/dammit/lib/python3.6/site-packages/doit/__init__.py", line 33, in <module>
from doit.doit_cmd import get_var
File "/home/up201505534/miniconda/envs/dammit/lib/python3.6/site-packages/doit/doit_cmd.py", line 14, in <module>
from .cmd_run import Run
File "/home/up201505534/miniconda/envs/dammit/lib/python3.6/site-packages/doit/cmd_run.py", line 8, in <module>
from .runner import Runner, MRunner, MThreadRunner
File "/home/up201505534/miniconda/envs/dammit/lib/python3.6/site-packages/doit/runner.py", line 8, in <module>
import cloudpickle
File "/home/up201505534/miniconda/envs/dammit/lib/python3.6/site-packages/cloudpickle/__init__.py", line 7, in <module>
from cloudpickle.cloudpickle import *
File "/home/up201505534/miniconda/envs/dammit/lib/python3.6/site-packages/cloudpickle/cloudpickle.py", line 61, in <module>
import typing
File "/opt/lib/python2.7/site-packages/typing.py", line 624, in <module>
AnyStr = TypeVar('AnyStr', bytes, unicode)
It appears the problem is in the typing package in the python 2.7 libs. I have installed typing.py with conda in the dammit environment, however the same error occurs. How can I fix this, and have the "import command" to search in the dammit/lib/python lib instead?
Here is the sys.path:
['', '/opt/python', '/opt/lib64/python2.7/site-packages', '/opt/lib/python2.7/site-packages', '/opt/lib64/python3.7/site-packages', '/opt/lib/python3.7/site-packages', '/home/up201505534', '/home/up201505534/miniconda/envs/dammit/lib/python36.zip', '/home/up201505534/miniconda/envs/dammit/lib/python3.6', '/home/up201505534/miniconda/envs/dammit/lib/python3.6/lib-dynload', '/home/up201505534/miniconda/envs/dammit/lib/python3.6/site-packages']
and the PYTHONPATH:
/opt/python:/opt/lib64/python2.7/site-packages:/opt/lib/python2.7/site-packages:/opt/lib64/python3.7/site-packages:/opt/lib/python3.7/site-packages:
Related
I set up my development environment on Fedora 35 and when I run any brownie command such as $ brownie console or even brownie --version I get the following error:
Traceback (most recent call last):
File "/home/philippbunke/.local/bin/brownie", line 5, in <module>
from brownie._cli.__main__ import main
File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/brownie/__init__.py", line 6, in <module>
from brownie.project import compile_source, run
File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/brownie/project/__init__.py", line 3, in <module>
from .main import ( # NOQA 401
File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/brownie/project/main.py", line 44, in <module>
from brownie.network import web3
File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/brownie/network/__init__.py", line 4, in <module>
from .account import Accounts
File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/brownie/network/account.py", line 12, in <module>
import eth_account
File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/eth_account/__init__.py", line 1, in <module>
from eth_account.account import ( # noqa: F401
File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/eth_account/account.py", line 8, in <module>
from cytoolz import (
File "/home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/cytoolz/__init__.py", line 3, in <module>
from .functoolz import *
ImportError: /home/philippbunke/.local/pipx/venvs/eth-brownie/lib64/python3.10/site-packages/cytoolz/functoolz.cpython-310-x86_64-linux-gnu.so: undefined symbol: _PyGen_Send
Setup:
Python=3.10.1
Cython=0.29.26
gcc/gcc-c=11.2.1-7.fc35.x86_64
Ganache CLI=v6.12.2
$ pipx list
venvs are in /home/philippbunke/.local/pipx/venvs
apps are exposed on your $PATH at /home/philippbunke/.local/bin
package eth-brownie 1.16.4, Python 3.10.1
- brownie
$ $PATH
/home/philippbunke/.local/bin:/home/philippbunke/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin
I have spent a whole day trying to fix this error, please help me out!
The problem here seems to be Python 3.10.1!
I used anaconda to create a new virtual environment with Python 3.8.12, installed brownie using pipx install --python python3.8 eth-brownie and it worked!
The trick here was, to also tell pipx to use another python version, otherwise it would create a dependency to the global python version, which is python 3.10 in my case.
I'm trying to use the responder package (https://github.com/taoufik07/responder) in a conda environment. But I'm getting the following error:
conda create --name tmp python=3.7
conda activate tmp
conda install -c conda-forge responder
python -c "import responder;"
And then I get this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/responder/__init__.py", line 1, in <module>
from .core import *
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/responder/core.py", line 1, in <module>
from .api import API
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/responder/api.py", line 20, in <module>
from . import models, status_codes
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/responder/models.py", line 12, in <module>
import graphene
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/graphene/__init__.py", line 19, in <module>
from .types import (
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/graphene/types/__init__.py", line 7, in <module>
from .scalars import Scalar, String, ID, Int, Float, Boolean
File "/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/graphene/types/scalars.py", line 2, in <module>
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
ImportError: cannot import name 'BooleanValue' from 'graphql.language.ast' (/Users/x/opt/anaconda3/envs/dex/lib/python3.7/site-packages/graphql/language/ast.py)
I think You haven't activated the Conda environment
MANUAL PROCESS
above error is not module error that import error so in that module something is missing go to the site-packages and into that library then check the code
REINSTALLING
remove that library, and re-install through the pip OR below command, check the python version.
$ pipenv install responder
$ pipenv install -e git+https://github.com/taoufik07/responder.git#egg=responder
Created the virtual env with pyenv
pyenv init
pyenv shell 3.9.0
python -m venv name_of_venv
Installed Django through pip in a virtual env:
pip install Django==3.1.7
Then when I run django-admin in cmd line I get the following error:
File "/Users/sushensatturu/envs/excel/bin/django-admin", line 5, in <module>
from django.core.management import execute_from_command_line
File "/Users/sushensatturu/envs/excel/lib/python3.9/site-packages/django/core/management/__init__.py", line 12, in <module>
from django.conf import settings
File "/Users/sushensatturu/envs/excel/lib/python3.9/site-packages/django/conf/__init__.py", line 19, in <module>
from django.utils.deprecation import RemovedInDjango40Warning
File "/Users/sushensatturu/envs/excel/lib/python3.9/site-packages/django/utils/deprecation.py", line 1, in <module>
import asyncio
File "/Users/sushensatturu/.pyenv/versions/3.9.0/lib/python3.9/asyncio/__init__.py", line 8, in <module>
from .base_events import *
Fixed:
Just had to uninstall and reinstall the python version through pyenv, then create a new virtial environment
Eg.
pyenv uninstall 3.9.0
pyenv install 3.9.0
I have virtual environment created for python 3.6. And I have install python3-pyqt5.qtwebkit package with apt-get. The package have installed in global python3.5 and its working, but if I try to import it from venv python3.6 there is import error... How can I install this package in my virtual environment? Or if this is not possible how can I use global package installed in 3.5 in my virtualenv 3.6 python.
Running with global python3.5
(virtualenv)
~/vcs-ss/sst master ✗ 5d ▴ ⚑ ✚ ◒
▶ python3.5 -c 'import PyQt5.QtWebKit; print(PyQt5.QtWebKit.__file__)'
/usr/lib/python3/dist-packages/PyQt5/QtWebKit.cpython-35m-x86_64-linux-gnu.so
Running with python3.6 from venv
(virtualenv)
~/vcs-ss/sst master ✗ 5d ▴ ⚑ ✚ ◒
▶ python3.6 test/e2e/browser.py
Traceback (most recent call last):
File "test/e2e/browser.py", line 8, in <module>
from PyQt5.QtWebKit import *
ModuleNotFoundError: No module named 'PyQt5.QtWebKit'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "test/e2e/browser.py", line 8, in <module>
from PyQt5.QtWebKit import *
ModuleNotFoundError: No module named 'PyQt5.QtWebKit'
In order to use system packages inside a virtual environment, you have to use --system-site-packages option when creating virtual env:
virtualenv --python=python3.6 --system-site-packages env
The same switch is available in Python3's venv.
Much better option is (if applicable in your case) to install all packages inside your virtual env, using pip.
If you look at the contents of the package (using dpkg --listfiles python3-pyqt5.qtwebkit) you'll probably see something like this:
/.
/usr
/usr/lib
/usr/lib/python3
/usr/lib/python3/dist-packages
/usr/lib/python3/dist-packages/PyQt5
/usr/lib/python3/dist-packages/PyQt5/QtWebKit.cpython-35m-x86_64-linux-gnu.so
/usr/lib/python3/dist-packages/PyQt5/QtWebKit.pyi
/usr/lib/python3/dist-packages/PyQt5/QtWebKitWidgets.cpython-35m-x86_64-linux-gnu.so
/usr/lib/python3/dist-packages/PyQt5/QtWebKitWidgets.pyi
/usr/share
/usr/share/doc
/usr/share/doc/python3-pyqt5.qtwebkit
/usr/share/doc/python3-pyqt5.qtwebkit/copyright
/usr/share/doc/python3-pyqt5.qtwebkit/changelog.Debian.gz
The package installs binary modules compiled for a specific python version (in this case: cpython-35m), you won't be able to use those from a python3.6 installation/venv directly because of the incompatible binary names.
For that to work you'd need to symlink all the .so files in the PyQt5 directory to your venv and there change cpython-35m-x86_64-linux-gnu to cpython-36m-x86_64-linux-gnu. Same for the sip libraries, as those are requiered by PyQt5. And that will only work if the ABI is compatible between the two versions.
A quick test with the versions mentioned above shows it works at least for simple scripts, but I can't give any guarantee.
I am trying to setup a new virtual env to work with django and flask.
installed
sudo pip install virtualenv
sudo pip install virtualenvwrapper
Then added in .profile these three lines;
export WORKON_HOME=$HOME/Envs
export PROJECT_HOME=$HOME/dev
source /Users/someone/anaconda/bin/virtualenvwrapper.sh
when i try to create a new project through
$ mkproject helloFlask
Error:
someone$ mkproject helloFlask
New python executable in helloFlask/bin/python
Installing setuptools, pip...
Complete output from command /Users/someone/Envs/helloFlask/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/someone/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-6.0.6-py2.py3-none-any.whl/pip/__init__.py", line 6, in <module>
File "/Users/someone/anaconda/lib/python2.7/optparse.py", line 77, in <module>
import textwrap
File "/Users/someone/anaconda/lib/python2.7/textwrap.py", line 10, in <module>
import string, re
File "/Users/someone/anaconda/lib/python2.7/string.py", line 83, in <module>
import re as _re
File "/Users/someone/Envs/helloFlask/lib/python2.7/re.py", line 105, in <module>
import sre_compile
File "/Users/someone/Envs/helloFlask/lib/python2.7/sre_compile.py", line 14, in <module>
import sre_parse
File "/Users/someone/Envs/helloFlask/lib/python2.7/sre_parse.py", line 17, in <module>
from sre_constants import *
File "/Users/someone/Envs/helloFlask/lib/python2.7/sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
What I am missing here ?