Pip install ultralytics throws ultralytics is not a valid editable requirement - virtualenv

I am using a conda environment with Python 3.10.8.
As described on the github, I tried:
git clone https://github.com/ultralytics/ultralytics
pip install -qe ultralytics
but that throws
ERROR: ultralytics is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).

-e argument specifies editable mode as you can see in pip documentation : https://pip.pypa.io/en/stable/cli/pip_install/#options
You can read in your error, this argument is the issue.
Just type :
pip install ultralytics
It should work.

Related

How to install diesel_cli with "cannot open input file libpq.lib" error?

I'm trying to install diesel_cli on my machine and have run into errors:
PS C:\> cargo install diesel_cli --no-default-features --features postgres
error: linking with `link.exe` failed: exit code: 1181
|
= note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\Owner\\AppData\\Local\\Temp\\rustc0hfMW4\\symbols.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.0.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.1.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.10.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.11.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.12.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.13.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.14.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.15.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.2.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.3.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.4.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.5.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.6.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.7.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.8.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.diesel.db6871c2-cgu.9.rcgu.o" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.3oc4g8xgeqr3xhil.rcgu.o" "/LIBPATH:C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps" "/LIBPATH:C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libdiffy-10116d1a46240765.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libansi_term-8ac785ba6dab3d54.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\liburl-085413cf155ebf4e.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libidna-e617760a188ae951.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libunicode_normalization-06cbce6ee463ab15.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libtinyvec-2700dcc8ca440a73.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libtinyvec_macros-5d0a0a5267ac9a02.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libunicode_bidi-3843cd708b9d5313.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libform_urlencoded-bc0ece478c9969ff.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libpercent_encoding-459d5072c4f6d412.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libdotenvy-d2dbc9637619d426.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libchrono-422b701f158856a2.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libnum_integer-2ae42b6e08c222a4.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libnum_traits-c406e65b13d6dcc2.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libserde_regex-766adf3a555ccd38.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libregex-f7212d89a6f67148.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libaho_corasick-5aae31e8a72badf2.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libmemchr-a65d51fb2ae7accd.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libregex_syntax-5a1f463340fb2444.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libheck-f97b054e733bf2b0.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libclap_complete-007464ddcbb6d7e3.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libdiesel_migrations-3bdc5b636ff49b93.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libmigrations_internals-057e468a6688077a.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libtoml-761527a98d007259.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libdiesel-3216c6f0692e5464.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libitoa-275f0509159cbce5.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libbyteorder-c046fcd7b7138a94.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libpq_sys-634b13f8c11ea75f.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libclap-5c0a23e17fdd1cb3.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libatty-8c20fbe3a5f86f4a.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libstrsim-3f67262decc03c33.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libtermcolor-2d2dc574ed6f0782.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libwinapi_util-24c50559c3aed431.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libwinapi-e00b279ba3acd452.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libtextwrap-a3c74de9cda85b72.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libclap_lex-ed195b3d1e438c9f.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libos_str_bytes-ee2d8aeaa96a27b2.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libindexmap-8887803fd6fdd584.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libhashbrown-f256a9213b6968e2.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libbitflags-64893d0f4e23f5eb.rlib" "C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\libserde-40c8cc7197730aad.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-2e5a4fde2066d4f2.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-a4e0bcf1e60e2edb.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-2d0f8274a5407337.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-dc68e6f9c2985e79.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-8bfb058d1afb96bd.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libminiz_oxide-fe2fe9acb704bcf5.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libadler-4e20259a2e504a61.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-ba723ab4066a2120.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-f9ca31420ed0b54e.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-753c3a361b9abd1c.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-22cf67e3a026b780.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-4bacd70ae093a213.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-2823e3c97f1346a4.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-2e984cab75d078cb.rlib" "C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-c045e84c0343a063.rlib" "libpq.lib" "advapi32.lib" "cfgmgr32.lib" "gdi32.lib" "kernel32.lib" "msimg32.lib" "ole32.lib" "opengl32.lib" "runtimeobject.lib" "shell32.lib" "user32.lib" "winspool.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "ws2_32.lib" "bcrypt.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:C:\\Users\\Owner\\AppData\\Local\\Temp\\cargo-installUiMeci\\release\\deps\\diesel-e71e8d3863826309.exe" "/OPT:REF,ICF" "/DEBUG" "/NATVIS:C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\Owner\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
= note: LINK : fatal error LNK1181: cannot open input file 'libpq.lib'
error: could not compile `diesel_cli` due to previous error
error: failed to compile `diesel_cli v2.0.0`, intermediate artifacts can be found at `C:\Users\Owner\AppData\Local\Temp\cargo-installUiMeci`
I've installed Rust successfully. I have Postgres 13 running locally and in Docker as well. But I'm still stuck and can't figure out what to do next. Any help is greatly appreciated!
Please confirm that you have the Postgres development libraries installed:
sudo apt install libpq-dev
For more help:
https://github.com/diesel-rs/diesel/issues/2026
https://github.com/diesel-rs/diesel/issues/2465
Maybe If you download this solves your problem
https://www.postgresql.org/download/windows/
On windows, after installation of postgresql define environment variable which points to client libs. PQ_LIB_DIR=C:\Program Files\PostgreSQL\13\lib
It's works for me!
sudo apt install libpq-dev

DevStack installation fails due to PyYAML

I am attempting to install DevStack on a CentOS system. I have performed the necessary setup for running stack.sh, but when I run it I am getting the following failure:
Installing collected packages: PyYAML, zipp, importlib-metadata, stevedore, colorama, pyperclip, cmd2, pyparsing, cliff, future, stestr, os-testr
Attempting uninstall: PyYAML
Found existing installation: PyYAML 5.3
ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
+inc/python:pip_install:1 exit_trap
+./stack.sh:exit_trap:489 local r=1
++./stack.sh:exit_trap:490 jobs -p
+./stack.sh:exit_trap:490 jobs=
+./stack.sh:exit_trap:493 [[ -n '' ]]
+./stack.sh:exit_trap:499 '[' -f '' ']'
+./stack.sh:exit_trap:504 kill_spinner
+./stack.sh:kill_spinner:399 '[' '!' -z '' ']'
+./stack.sh:exit_trap:506 [[ 1 -ne 0 ]]
+./stack.sh:exit_trap:507 echo 'Error on exit'
Error on exit
+./stack.sh:exit_trap:509 type -p generate-subunit
+./stack.sh:exit_trap:512 [[ -z /opt/stack/logs ]]
+./stack.sh:exit_trap:515 /usr/bin/python3.6 /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs
ebtables v1.8.4 (nf_tables): table `broute' is incompatible, use 'nft' tool.
+./stack.sh:exit_trap:524 exit 1
Researching this on the Internet, I have learned that this failure apparently occurs when python's pip3 commamd attempts to uninstall something that was installed using distutils (including, apparently, PyYAML). I also see that somewhere in stack.sh PyYAML gets installed, then later an attempt is made to uninstall it which fails!
I have also looked at the setup.py script that comes with Devstack, but that script apparently does not use distutils. It is used elsewhere during the PyYAML install, but cannot find where it is.
Worse, there are workarounds (including using the --ignore-installed option for PIP), but I am not seeing where to place that option in stack.sh or any of the other files I have seen.
As things stand, stack.sh looks to be unusable. It is incapable of installing Devstack because of this problem.
Has anyone found a way to install Devstack and get around this problem? Is there an alternative to stack.sh? To devstack?
I have found a solution to my problem:
Do not use Devstack. Use Packstack.
I have even posted a bug report on this problem for Devstack. It doesn't appear that it is going to be fixed in the near future. Consequently, those seeking to create a development installation should use Packstack. I was able to install and run Openstack with Packstack using the instructions provided in:
https://www.linuxtechi.com/install-openstack-centos-8-with-packstack/

Travis CI failed because installing dependencies timed out

Travis CI for my Github repo keeps failing and I didn't know why, until I read through the Job log and figured out that many dependencies couldn't be downloaded on their machines.
For example, the xcolor package failed to install:
[20/23, 03:54/04:02] install: xcolor [17k]
Downloading
ftp://tug.org/historic/systems/texlive/2015/tlnet-final/archive/xcolor.tar.xz
did not succeed, please retry.
TLPDB::_install_package: couldn't unpack ftp://tug.org/historic/systems/texlive/2015/tlnet-final/archive/xcolor.tar.xz to /home/travis/texmf
which results in the following error:
Latexmk: Missing input file: 'xcolor.sty' from line
'! LaTeX Error: File `xcolor.sty' not found.'
Latexmk: Log file says no output from latex
Latexmk: For rule 'pdflatex', no output was made
The problem is I'm working on a LaTeX project, and LaTeX environments tend to be huge with lots of supporting packages. Here is the relevant part of my setup.sh, which is already the minimal requirement:
sudo tlmgr install \
xkeyval ifthen amsmath bm \
longtable ctex tabu array \
colortbl berasans graphicx longtable \
etoolbox lastpage amssymb mathrsfs \
multirow xeCJK environ after \
booktabs hyperref epstopdf tabu \
fancyhdr listings amsfonts latexsym \
hhline CJK longtable pifont \
geometry ifpdf bmpsize hologo \
fancybox appendix amsbsy paralist \
tabularx xCJK2uni hologo calc \
fontenc ifxetex xcolor palatino
Can I make sure that all required packages are successfully downloaded & installed before the building phase, say, by letting the server to retry several times? If so, how?
From the Travis docs:
If you are getting network timeouts when trying to download dependencies, either use the built in retry feature of your dependency manager or wrap your install commands in the travis_retry function.
For example, in your .travis.yml:
install: travis_retry pip install myawesomepackage
travis_retry will attempt up three times if the return code is non-zero.

Chef cookbook for installing mongodb-shell only

I am trying to install a mongo client via chef. Essentially this is what I have been doing in manual installs:
sudo vi /etc/yum.repos.d/mongodb.repo
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
sudo yum install mongodb-org-shell-2.6.7
I don't want to reinvent the wheel here, nor do I want to install anything other than the shell. This cookbook looks like a good resource, but I cannot get it to install just the shell:
https://github.com/edelight/chef-mongodb
But it seems to not allow for any of the main components to be installed. Will i need to LWRP?
Well i picked apart the mongodb cookbook - to this tune:
yum_repository 'mongodb-org-3.0' do
description 'mongodb RPM Repository'
baseurl "http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/#{node['kernel']['machine'] =~ /x86_64/ ? 'x86_64' : 'i686'}"
action :create
gpgcheck false
enabled true
end
case node['platform_family']
when 'debian'
# this options lets us bypass complaint of pre-existing init file
# necessary until upstream fixes ENABLE_MONGOD/DB flag
packager_opts = '-o Dpkg::Options::="--force-confold" --force-yes'
when 'rhel'
# Add --nogpgcheck option when package is signed
# see: https://jira.mongodb.org/browse/SERVER-8770
packager_opts = '--nogpgcheck'
else
packager_opts = ''
end
package node[:frt_mongodb][:package_name] do
options packager_opts
action :install
version node[:frt_mongodb][:package_version]
end
That said it looks like I should be able to use that cookbook configured with the right attributes to aCcomplish this. The biggest problem is that the recipe within manipulates files that aren't necessary for the shell.

Does virtualenv just modify the pythonpath?

I'm deploying Django on a production server together with virtualenv, and am having trouble activating virtualenv on the server with
source .../bin/activate
I did a little research, and found that the pythonpath is changed depending on if we are or aren't in a virtualenv.
sys.path (with virtualenv activated)
['',
'/.../virtualenv/test_path/bin',
'/.../virtualenv/test_path/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
'/.../virtualenv/test_path/local/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
'/.../virtualenv/test_path/lib/python2.7',
'/.../virtualenv/test_path/lib/python2.7/plat-linux2',
'/.../virtualenv/test_path/lib/python2.7/lib-tk',
'/.../virtualenv/test_path/lib/python2.7/lib-old',
'/.../virtualenv/test_path/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/.../virtualenv/test_path/local/lib/python2.7/site-packages',
'/.../virtualenv/test_path/local/lib/python2.7/site-packages/IPython/extensions']
sys.path (without activating virtualenv):
['',
'/usr/local/bin',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/local/lib/python2.7/dist-packages/IPython/extensions']
Is is sufficient to just change the pythonpath to point to the virtualenv
.../python2.7/site-packages
folder to get the same results as running
source .../bin/activate
?
No, it is not. virtualenv is not only about site-packages, it is about a whole isolated python environment.
Doing source /path/to/venv/bin/activate just changes your $PATH environment variable to include your virtualenv bin directory as first lookup.
If you call python directly, it is just a shortcut for:
$ /path/to/venv/bin/python myscript.py
And if you call pip in an activated virtualenv, it is the same as:
$ /path/to/venv/bin/pip install XYZ