{"id":1041,"date":"2011-04-05T14:05:37","date_gmt":"2011-04-05T18:05:37","guid":{"rendered":"http:\/\/mossiso.com\/?p=1041"},"modified":"2014-09-22T15:16:51","modified_gmt":"2014-09-22T19:16:51","slug":"python-trac-virtualenv-and-centos","status":"publish","type":"post","link":"https:\/\/mossiso.com\/2011\/04\/05\/python-trac-virtualenv-and-centos\/","title":{"rendered":"Python, Trac, virtualenv and CentOS"},"content":{"rendered":"

I’ve just spent too much time figuring this out. I’ve had to piece it together from many other sites.<\/p>\n

I need to set up Trac .12 on CentOS 5, but want to do that without interfering with the current setup of Trac and Subversion on the system.<\/p>\n

So in comes virtualenv<\/a>. This allows you to create a virtual environment for python. Like a separate install. The beauty is, once this is set up you can install different versions of python packages (like Trac and Subversion) that don’t have to interact with each other.<\/p>\n

To install virtualenv was pretty simple. With root permissions do<\/p>\n

easy_install virtualenv<\/pre>\n

Now, as your normal user, you can install a virtual environment.<\/p>\n

virtualenv --no-site-packages foo<\/pre>\n

This will create a new folder called foo with a virtual environment for python. It won’t reference any of the other installed python packages (like the old Trac version).<\/p>\n

Now upgrade the Genshi package with<\/p>\n

easy_install --upgrade Genshi<\/pre>\n

Then, to install Trac do<\/p>\n

easy_install Trac==0.12<\/pre>\n

That’s the part that always hung me up. I would just do easy_install Trac<\/span>\u00a0\u00a0which would cough up this ugly error:<\/p>\n

Searching for trac\r\nReading http:\/\/pypi.python.org\/simple\/trac\/\r\nReading http:\/\/trac.edgewall.org\/\r\nReading http:\/\/trac.edgewall.org\/wiki\/TracDownload\r\nReading http:\/\/trac.edgewall.com\/\r\nReading http:\/\/projects.edgewall.com\/trac\r\nReading http:\/\/projects.edgewall.com\/trac\/wiki\/TracDownload\r\nBest match: Trac 0.12.2\r\nDownloading ftp:\/\/ftp.edgewall.com\/pub\/trac\/Trac-0.12.2.zip\r\nProcessing Trac-0.12.2.zip\r\nRunning setup.py -q bdist_egg --dist-dir trac-dir\/trac\/egg-dist-tmp-JmdQXW\r\nTraceback (most recent call last):\r\nFile \"\/home\/ammon\/foo\/bin\/easy_install\", line 7, in ?\r\nsys.exit(\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/command\/easy_install.py\", line 1712, in main\r\nwith_ei_usage(lambda:\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/command\/easy_install.py\", line 1700, in with_ei_u\r\nsage\r\nreturn f()\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/command\/easy_install.py\", line 1716, in <lambda>\r\ndistclass=DistributionWithoutHelpCommands, **kw\r\nFile \"\/usr\/lib64\/python2.4\/distutils\/core.py\", line 149, in setup\r\ndist.run_commands()\r\nFile \"\/usr\/lib64\/python2.4\/distutils\/dist.py\", line 946, in run_commands\r\nself.run_command(cmd)\r\nFile \"\/usr\/lib64\/python2.4\/distutils\/dist.py\", line 966, in run_command\r\ncmd_obj.run()\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/command\/easy_install.py\", line 211, in run\r\nself.easy_install(spec, not self.no_deps)\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/command\/easy_install.py\", line 446, in easy_insta\r\nll\r\nreturn self.install_item(spec, dist.location, tmpdir, deps)\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/command\/easy_install.py\", line 476, in install_it\r\nem\r\ndists = self.install_eggs(spec, download, tmpdir)\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/command\/easy_install.py\", line 655, in install_eg\r\ngs\r\nreturn self.build_and_install(setup_script, setup_base)\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/command\/easy_install.py\", line 930, in build_and_\r\ninstall\r\nself.run_setup(setup_script, setup_base, args)\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/command\/easy_install.py\", line 919, in run_setup\r\nrun_setup(setup_script, args)\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/sandbox.py\", line 61, in run_setup\r\nDirectorySandbox(setup_dir).run(\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/sandbox.py\", line 105, in run\r\nreturn func()\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/sandbox.py\", line 64, in <lambda>\r\n{'__file__':setup_script, '__name__':'__main__'}\r\nFile \"setup.py\", line 110, in ?\r\nFile \"\/usr\/lib64\/python2.4\/distutils\/core.py\", line 110, in setup\r\n_setup_distribution = dist = klass(attrs)\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/dist.py\", line 260, in __init__\r\nself.fetch_build_eggs(attrs.pop('setup_requires'))\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/setuptools\/dist.py\", line 283, in fetch_build_eggs\r\nfor dist in working_set.resolve(\r\nFile \"\/home\/ammon\/foo\/lib\/python2.4\/site-packages\/setuptools-0.6c12dev_r88795-py2.4.egg\/pkg_resources.py\", line 569, in resolve\r\nraise VersionConflict(dist,req) # XXX put more info here\r\npkg_resources.VersionConflict: (Genshi 0.6dev (\/usr\/local\/lib\/python2.4\/site-packages\/Genshi-0.6dev-py2.4-linux-x86_64.egg), Requirement.parse('Genshi\r\n>=0.6'))<\/pre>\n

Notice the last line referencing a version conflict with the “old” Genshi at \/usr\/local\/lib\/python2.4\/site-packages. That’s the system-wide default install. So making explicit that you want to install Trac==0.12 is the way to get it installed in a virtual environment.<\/p>\n

Now I just need to figure out how to configure Trac and Subversion using this virtual environment, and copy over a live older version of each.<\/p>\n","protected":false},"excerpt":{"rendered":"

I’ve just spent too much time figuring this out. I’ve had to piece it together from many other sites. I need to set up Trac .12 on CentOS 5, but want to do that without interfering with the current setup of Trac and Subversion on the system. So in comes virtualenv. This allows you to … Continue reading Python, Trac, virtualenv and CentOS<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1044,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[3,167],"tags":[219,218,216,217],"class_list":["post-1041","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding","category-technical","tag-python","tag-subversion","tag-system-administration","tag-trac"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/mossiso.com\/wp-content\/uploads\/2011\/04\/00001000023.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9wosP-gN","_links":{"self":[{"href":"https:\/\/mossiso.com\/wp-json\/wp\/v2\/posts\/1041"}],"collection":[{"href":"https:\/\/mossiso.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mossiso.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mossiso.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mossiso.com\/wp-json\/wp\/v2\/comments?post=1041"}],"version-history":[{"count":7,"href":"https:\/\/mossiso.com\/wp-json\/wp\/v2\/posts\/1041\/revisions"}],"predecessor-version":[{"id":1658,"href":"https:\/\/mossiso.com\/wp-json\/wp\/v2\/posts\/1041\/revisions\/1658"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mossiso.com\/wp-json\/wp\/v2\/media\/1044"}],"wp:attachment":[{"href":"https:\/\/mossiso.com\/wp-json\/wp\/v2\/media?parent=1041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mossiso.com\/wp-json\/wp\/v2\/categories?post=1041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mossiso.com\/wp-json\/wp\/v2\/tags?post=1041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}