I want to use the essentia module in my python virtualenv and the version of python is 2.7.6.
After I executed
brew tap MTG/essentia
I can't find this module in my Pycharm.
I've also tried to install other package such as matplotlib using
sudo pip install matplotlib
under my virtualenv path.
The directory '/Users/username/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/username/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): matplotlib in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.5 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): tornado in /Library/Python/2.7/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): pyparsing>=1.5.6 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)
Collecting nose (from matplotlib)
/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading nose-1.3.7-py2-none-any.whl (154kB)
100% |████████████████████████████████| 155kB 46kB/s
Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade): singledispatch in /Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade): certifi in /Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade): backports-abc>=0.4 in /Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade): six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from singledispatch->tornado->matplotlib)
Installing collected packages: nose
Successfully installed nose-1.3.7
You are using pip version 7.1.2, however version 8.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I checked in Pycharm, however, in the interpreter there was no matplotlib module.
How can I install packages in my virtualenv?
If the pip package is not available, you can find the brew installation in your local python directory.
Quick Fix:
Install essentia to your local environment.
Append the local essentia package to your virtual environment
sys.path.append('/usr/local/lib/python2.7/site-packages')
import essentia
Long Fix:
If you want to fully contain the packages in your virtual environment, try copying the local site-packages/essentia folder to your virtual environment
Copy over any other dependencies such as site-packages/numpy. Check brew's Cellar (/usr/local/Cellar) for other dependencies
You should not install python modules with brew, instead you should use pip. The following method has worked for me in OSX.
Desktop $ virtualenv myproject # Create the virtual environment
Desktop $ cd myproject # Change into that directory
Desktop $ source bin/activate # Enter the virtual environment
(myproject) $ sudo pip install matplotlib # Install matplotlib
(myproject) $ deactivate # Exit from the virtual environment
Look here for a further explanation of virtualenv.
Related
i installed django-ckeditor with pip but it goes to the "/home/def-dev/.local/lib/python3.8/site-packages" path when i'm trying to create venv manually.
but when i create project with pycharm it goes to the "./venv/lib/python3.8/site-packages" path
that this path belong's to internal project's venv .
and this make's unknown for pycharm .
what should i do to make pycharm find packages from "/home/def-dev/.local/lib/python3.8/site-packages" or when i'm creating venv manually pip save's packages into "./venv/lib/python3.8/site-packages" path.
when i create venv manually
$ pip3 install django-ckeditor
Requirement already satisfied: django-ckeditor in /home/def-dev/.local/lib/python3.8/site-
packages (5.9.0)
Requirement already satisfied: django-js-asset>=1.2.2 in /home/def-
dev/.local/lib/python3.8/site-packages (from django-ckeditor) (1.2.2)
when i create venv with pycharm
$ pip3 install django-ckeditor
Requirement already satisfied: django-ckeditor in ./venv/lib/python3.8/site-packages (5.9.0)
Requirement already satisfied: django-js-asset>=1.2.2 in ./venv/lib/python3.8/site-packages
(from django-ckeditor) (1.2.2)
I want to check PEP-3101 standard for some codes that I have, for this, I want to install flake8-pep3101.
I can not directly install it as it requires PIP upgrade, so I upgrade my PIP from 19.0.3 to 19.1.1.
After upgrade, I began to install it by running
pip install flake8-pep3101
I received this error:
"Collecting flake8-pep3101pip ERROR: Could not find a version that satisfies the requirement flake8-pep3101pip (from versions: none)
ERROR: No matching distribution found for flake8-pep3101pip"
I already have FLAKE8 installed and Phyton 3.7.
What can I do to solve this problem ? it seems that there is no flake8-pep3101 module for this particular python.
I tried to upgrade FLAKE8 using PIP command "pip install --upgrade FLAKE8" and "pip3 install --upgrade FLAKE8":
It gives me error :
Requirement already up-to-date: FLAKE8 in c:\users\mydir\dev\myvirt\lib\site-packages (3.7.7) Requirement already satisfied, skipping upgrade: entrypoints<0.4.0,>=0.3.0 in c:\users\mydir\dev\myvirt\lib\site-packages (from FLAKE8) (0.3) Requirement already satisfied, skipping upgrade: pycodestyle<2.6.0,>=2.5.0 in c:\users\mydir\dev\myvirt\lib\site-packages (from FLAKE8) (2.5.0)
Requirement already satisfied, skipping upgrade: pyflakes<2.2.0,>=2.1.0 in c:\users\mydir\dev\myvirt\lib\site-packages (from FLAKE8) (2.1.1) Requirement already satisfied, skipping upgrade: mccabe<0.7.0,>=0.6.0 in c:\users\mydir\dev\myvirt\lib\site-packages (from FLAKE8) (0.6.1)
From what I can tell, you need to update/reinstall FLAKE8.
To update FLAKE8, use:
pip install --upgrade `FLAKE8`
To install the latest version of FLAKE8, use:
pip install `FLAKE8`
To install a specific version of FLAKE8, use:
pip install FLAKE8==<VERSION>
To install a version of FLAKE8 greater than or equal to one version and less than another, use:
pip install FLAKE8>=<LOW>,<HIGH>
NOTE: if you're using python3 use pip3 instead of pip.
Good luck.
I have already installed pipenv using,
pip install pipenv on the directory which was installed successfully. But
pipenv install Django==2.1 does not seem to work. In fact, no command is getting executed using pipenv.
pip install pipenv
Collecting pipenv
Downloading https://files.pythonhosted.org/packages/13/b4/3ffa55f77161cff9a5220f162670f7c5eb00df52e00939e203f601b0f579/pipenv-2018.11.26-py3-none-any.whl (5.2MB)
100% |████████████████████████████████| 5.2MB 5.5MB/s
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.6/dist-packages (from pipenv) (40.9.0)
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading https://files.pythonhosted.org/packages/ba/f8/50c2b7dbc99e05fce5e5b9d9a31f37c988c99acd4e8dedd720b7b8d4011d/virtualenv_clone-0.5.3-py2.py3-none-any.whl
Requirement already satisfied: certifi in /usr/local/lib/python3.6/dist-packages (from pipenv) (2019.3.9)
Requirement already satisfied: pip>=9.0.1 in /usr/local/lib/python3.6/dist-packages (from pipenv) (19.0.3)
Collecting virtualenv (from pipenv)
Downloading https://files.pythonhosted.org/packages/33/5d/314c760d4204f64e4a968275182b7751bd5c3249094757b39ba987dcfb5a/virtualenv-16.4.3-py2.py3-none-any.whl (2.0MB)
100% |████████████████████████████████| 2.0MB 17.1MB/s
Installing collected packages: virtualenv-clone, virtualenv, pipenv
Successfully installed pipenv-2018.11.26 virtualenv-16.4.3 virtualenv-clone-0.5.3
pipenv install Django==2.1
File "", line 1
pipenv install Django==2.1
^
SyntaxError: invalid syntax
*
Anything on Google Colab suggestions would be very helpful!
*
pip is a shell command. I assume Google Colab has made pip available as a special command(*) (without the % syntax), but that doesn't mean any other shell command works as such. That is why you get a SyntaxError: it is not recognised as normal Python syntax.
You can work around it by using !pipenv install 'Django==2.1' (the single quotes may not be necessary, but the exclamation work is).
I doubt, however, that you really need a virtual environment in the first place. This is not on your regular machine, where you may want to keep dependencies apart. Instead, just start a new notebook for a new project, and install Django as normal: pip install Django. I wouldn't bother with pipenv and virtual environments inside notebooks. There doesn't seem to be any use for it.
(*) Try, for example, pip?, and note the help lists its usage with the %pip syntax. I assume that, if it's not ambiguous, Colab will use %pip when called as pip. The same works for, for example, ls instead of %ls.
I was following the Flask tutorial and at some point installed an 'incomplete' version of the flaskr micro-blogging app. I would like to 'overwrite' this installation with one obtained from https://github.com/pallets/flask/tree/master/examples/flaskr.
However, in the directory ~/dev/scratch/flask/examples/flaskr, if I try to run
sudo pip install --editable .
I get the following:
The directory '/home/kurt/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/kurt/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Obtaining file:///home/kurt/dev/scratch/flask/examples/flaskr
Requirement already satisfied: flask in /usr/local/lib/python2.7/dist-packages (from flaskr==0.0.0)
Requirement already satisfied: itsdangerous>=0.21 in /usr/local/lib/python2.7/dist-packages (from flask->flaskr==0.0.0)
Requirement already satisfied: click>=2.0 in /usr/local/lib/python2.7/dist-packages (from flask->flaskr==0.0.0)
Requirement already satisfied: Werkzeug>=0.7 in /usr/local/lib/python2.7/dist-packages (from flask->flaskr==0.0.0)
Requirement already satisfied: Jinja2>=2.4 in /usr/lib/python2.7/dist-packages (from flask->flaskr==0.0.0)
Requirement already satisfied: MarkupSafe in /usr/lib/python2.7/dist-packages (from Jinja2>=2.4->flask->flaskr==0.0.0)
Installing collected packages: flaskr
Found existing installation: flaskr 0.0.0
Can't uninstall 'flaskr'. No files were found to uninstall.
Running setup.py develop for flaskr
Successfully installed flaskr
Apparently, pip found an 'existing installation' which it can't uninstall. I'd like to 'wipe out' this installation; however, if I try search for it using, in the directory /usr/local/lib,
find . -name '*flaskr*'
the only result I get is
./python2.7/dist-packages/flaskr.egg-link
If I rm this file, it seems to 'come back' automatically.
How can I re-install the 'flaskr' app cloned from its Github repository?
I solved the problem by going back to the directory I had installed the 'incomplete' version of flaskr from, and running the command
sudo python setup.py develop --uninstall
which produced the confirmation
running develop
Removing /usr/local/lib/python2.7/dist-packages/flaskr.egg-link (link to .)
Link points to ['/home/kurt/dev/scratch/flask/examples/flaskr', '.']: uninstall aborted
Then, going back to the directory with the 'complete' version (~/dev/scratch/flask/examples/flaskr), I ran sudo pip install --editable . followed by export FLASK_APP=flaskr. Then the command
flask initdb
prints the expected output
Initialized the database.
I'm trying to follow this guide.
I made virtualenv and installed flask in it:
Requirement already satisfied (use --upgrade to upgrade): Flask in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in /usr/local/lib/python2.7/dist-packages (from Flask)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in /usr/local/lib/python2.7/dist-packages (from Flask)
After pip freeze > requirements.txt the file contains only:
argparse==1.2.1
distribute==0.6.28
wsgiref==0.1.2
And there is no Flask package. I'm trying to run simple example and got:
ImportError: No module named flask
How to install the package properly?
You need to run pip freeze > reuirements.txt inside your virtualenv. Thus, make sure that your virtualenv was activated correctly. As the Heroku documentation is mostly written from Linux point of view, this may be a little tricky especially on Windows (see a related question):
Windows command-prompt activation is done using venv\Scripts\activate.bat
If you are using Windows PowerShell, you need to run venv\Scripts\activate.ps1 instead.
Note that you need to activate virtualenv for sudo as well. Example:
sudo bash
source venv/bin/activate
pip install Flask
However one of the points in virtualenv is that you don't need sudo. Thus, you could simply omit using sudo and simply just run:
source venv/bin/activate
pip install Flask