Hello
I have Ubuntu 10.10 installed. And I wanted to try out Turbogear. I got the installation steps correctly I think. Problems that I have encountered though is in the steps where you create the quickstart example
When I type in the command to create a quickstart example I followed the default values which is example, no, yes. To create the example. At the last steps where I type in paster setup-app development.ini, paster serve development.ini It will complain no module named template.Genshi. I don't get what it means by that. And I couldn't find any answer to this problem on the Internet either. Can it be because Ubuntu got python 2.6.6 installed as standard?
These are the steps I've followed, found on here
$ virtualenv --no-site-packages -p python2.6 tg2env
$ cd tg2env/
$ source bin/activate
(tg2env)$ easy_install -i http://www.turbogears.org/2.1/downloads/current/index tg.devtools
(tg2env)$ paster quickstart example
(tg2env)$ cd example/
(tg2env)$ python setup.py develop
(tg2env)$ nosetests
(tg2env)$ paster setup-app development.ini
(tg2env)$ paster serve development.ini
(tg2env)$ deactivate
And here's the error I get when running paster setup-app development.ini
File "/home/starcorn/tg2env/bin/paster", line 9, in <module>
load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')()
File "/home/starcorn/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 84, in run
invoke(command, command_name, options, args[1:])
File "/home/starcorn/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 123, in invoke
exit_code = runner.run(args)
File "/home/starcorn/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py", line 68, in run
return super(AbstractInstallCommand, self).run(new_args)
File "/home/starcorn/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 218, in run
result = self.command()
File "/home/starcorn/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py", line 456, in command
self, config_file, section, self.sysconfig_install_vars(installer))
File "/home/starcorn/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py", line 598, in setup_config
mod.setup_app, command, filename, section, vars)
File "/home/starcorn/tg2env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py", line 612, in _call_setup_app
func(command, conf, vars)
File "/home/starcorn/tg2env/example/example/websetup/__init__.py", line 17, in setup_app
load_environment(conf.global_conf, conf.local_conf)
File "/home/starcorn/tg2env/lib/python2.6/site-packages/TurboGears2-2.1-py2.6.egg/tg/configuration.py", line 581, in load_environment
setup()
File "/home/starcorn/tg2env/lib/python2.6/site-packages/TurboGears2-2.1-py2.6.egg/tg/configuration.py", line 392, in setup_genshi_renderer
from tg.dottednames.genshi_lookup import GenshiTemplateLoader
File "/home/starcorn/tg2env/lib/python2.6/site-packages/TurboGears2-2.1-py2.6.egg/tg/dottednames/genshi_lookup.py", line 6, in <module>
from genshi.template import TemplateLoader
ImportError: No module named genshi.template
As to why it didn't get installed is an issue for turbogears, but...
$ easy_install Genshi
will fix this.
Related
ive updated to python3 and downloaded virtualenv using:
sudo /usr/bin/easy_install virtualenv
when i go to start the virtualenv i got the following error message :
virtualenv project1
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 6, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3241, in <module>
#_call_aside
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3225, in _call_aside
f(*args, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 585, in _build_master
return cls._build_from_requirements(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'zipp>=0.4' distribution was not found and is required by importlib-resources
i looked around and realised the that 'zipp' had not been installed so i installed that also. when i went to run the virtualenv again i got the same error message again as above. and for some reason it keeps referencing python 2.7 even though ive upgraded to python3.
please try this ..
you just follow Exactly the bellow Items :
Open your Command Prompt AS ADMINISTRATOR -> right click on CMD and RUN AS ADMINISTRATOR
go to which Folder to you want to create your VirtualENV : For example : > Cd C:\Users...\Documents\python\src
type it : PIP install Virtualenv
make sure your internet connection is Ok
4.type : python -m venv env
and then you can create your project inside this env folder..
all Comment code should be write in Command Prompt AS Administrator
i ended up using the built in python 3 venv package. it works just as well and it was straight forward and simple. thank you for all the help
start the virtual environment: python3 -m venv project1
activate the virtual environment: source project1/bin/activate
deactivate the virtual environment: deactivate
If you're using Python 3.3 or later, you can use the built-in venv [https://docs.python.org/3/library/venv.html] module. This will reduce the number of dependencies, making installation and troubleshooting a bit easier.
To double-check that you are invoking the correct Python interpreter, run python3 -V or python -V (depending on how it's aliased).
Just try out.
virtualenv venv
It should create a venv directory in same directory if python 3.x is being used.
I generally use python2.7 for projects.
For one project, I need to use python 3.5+.
I installed python3 on Mac.
Also installed virtualenv using pip3.
Now when I run the command
virtualenv -p python3 test
I get the following error:
Running virtualenv with interpreter /usr/bin/python3
Already using interpreter /Library/Developer/CommandLineTools/usr/bin/python3
Using base prefix '/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7'
New python executable in /Users/sourabh/virtualenvs/test/bin/python3
Also creating executable in /Users/sourabh/virtualenvs/test/bin/python
Traceback (most recent call last):
File "/Library/Python/3.7/site-packages/virtualenv.py", line 2632, in <module>
main()
File "/Library/Python/3.7/site-packages/virtualenv.py", line 870, in main
symlink=options.symlink,
File "/Library/Python/3.7/site-packages/virtualenv.py", line 1156, in create_environment
install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
File "/Library/Python/3.7/site-packages/virtualenv.py", line 1621, in install_python
shutil.copy(original_python, py_executable)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/shutil.py", line 245, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/shutil.py", line 103, in copyfile
if _samefile(src, dst):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/shutil.py", line 88, in _samefile
return os.path.samefile(src, dst)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/genericpath.py", line 96, in samefile
s1 = os.stat(f1)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
For making a virtual environment with Python 3
Use this for making env
python3 -m venv env
To activate env
source env/bin/activate
Improve upon answer of #ParthS007 (Wanted to add a comment to the existing answer but couldn't due to not enough reputation):
Corrected the virtual environment name to be the common used one venv so it's easier for beginners like me to use/understand in conjunction with other tutorials.
Added how to deactivate and remove virtual environment too.
For making a virtual environment with Python 3
Use this for making env
python3 -m venv venv
To activate env
source env/bin/activate
To deactivate env
deactivate
To remove env
rm -rf venv
I get this error while installing Misago the forum. I don't know what's causing since I have Django installed. Please help me anyone.
xxxxx#xxxxx:~/Desktop/newfeed/startupindia$ python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 23, in <module>
execute_from_command_line(sys.argv)
File "/home/xxxxx/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/home/xxxxx/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 324, in execute
django.setup()
File "/home/xxxxx/.local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/xxxxx/.local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/xxxxx/.local/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named misago
I haven't heard of Misago before, however from the documentations:
Version ~0.5.5 Alpha 1
Misago documentation
Misago is delivered with Vagrant.
Vagrant is a Virtual Machine, and can be started with the vagrant up command from the root directory.
All the required installations will be done with an installation script being executed on the vagrant up command.
Vagrant: What, Why and How?
Version 0.6 Alpha 1
The Misago version 0.6 Alpha 1 from GitHub does not contain vagrant, but is installed with an install script:
Development
To start Misago site locally, first setup and activate virtual environment for it and then fire following commands:
python setup.py install
More about the virtual envirionment.
To test and run the server:
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
It seems that you didn't set the environment variable. first of type into terminal
virtualenv env
source env/bin/activate
then try pip freeze
if misago is missing here then install misago again.
All,
I followed the following steps from scrapy.org to updated default system packages and install scrapy, the open source framework for building spiders found here: http://doc.scrapy.org/en/1.1/intro/install.html
I ran the xcode-select --install command from terminal
ran the command to install hombebrew package: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
I tried to run this command, but don't know if I correctly updated, I copied and pasted this exactly: echo "export PATH=/usr/local/bin:/usr/local/sbin:$PATH" >> ~/.bashrc
per the installation directions on scrapy, I tried to verify that changes had take place: source ~/.bashrc
I ran the command: brew install python
ran the command : brew update; brew upgrade python
ran the command: pip install Scrapy
I wanted to be very clear with the above commands, trying to update and install packages. I proceeded to follow directions to create a project, define items and create my first spider.
Lastly when I ran the command scrapy crawl dmoz I get the below error message
crawl command with output and error message
Romans-MBP:tutorial Roman$ scrapy crawl dmoz
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 11, in <module>
sys.exit(execute())
File "/usr/local/lib/python2.7/site-packages/scrapy/cmdline.py", line 141, in execute
cmd.crawler_process = CrawlerProcess(settings)
File "/usr/local/lib/python2.7/site-packages/scrapy/crawler.py", line 238, in __init__
super(CrawlerProcess, self).__init__(settings)
File "/usr/local/lib/python2.7/site-packages/scrapy/crawler.py", line 129, in __init__
self.spider_loader = _get_spider_loader(settings)
File "/usr/local/lib/python2.7/site-packages/scrapy/crawler.py", line 325, in _get_spider_loader
return loader_cls.from_settings(settings.frozencopy())
File "/usr/local/lib/python2.7/site-packages/scrapy/spiderloader.py", line 33, in from_settings
return cls(settings)
File "/usr/local/lib/python2.7/site-packages/scrapy/spiderloader.py", line 20, in __init__
self._load_all_spiders()
File "/usr/local/lib/python2.7/site-packages/scrapy/spiderloader.py", line 28, in _load_all_spiders
for module in walk_modules(name):
File "/usr/local/lib/python2.7/site-packages/scrapy/utils/misc.py", line 63, in walk_modules
mod = import_module(path)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named spiders
Romans-MBP:tutorial Roman$
Check in scrapy/tutorial/tutorial/spiders/[your_spider].py the name of your spider, that should be run with scrapy crawl command. In the example below, the name is dmozdirectory and the run command is scrapy crawl dmozdirectory
Example:
class DmozSpider(scrapy.Spider):
name = "dmozdirectory"
allowed_domains = ["dmoz.org"]
Also, you should be in the root directory of your project when running that command, in scrapy/tutorial/
Some version info:
OS: Mac OS X 10.8.4
Python: 2.7.2 (that came with the Mac OS X)
PyPy: 2.0.2
iPython: 0.13.2
PyCharm: 2.5.1
PyCharm's Python console fails when PyPy and iPython co-exist in a virtualenv created project.
I created three virtual environment projects. I did not activate any of the virtual environments. So, the system python still exists as it is.
Env - 1:
$ virtualenv -p /path/to/system/installed/python /path/to/sample_1/virtualenv/project
$ /path/to/sample_1/virtualenv/project/bin/pip install ipython
Now, when I run the python console in PyCharm it works fine. (Interpreter in PyCharm is set to /path/to/sample_1/virtualenv/project/bin/python)
Env - 2:
$ virtualenv -p /path/to/pypy /path/to/sample_2/virtualenv/project
Now, when I run the python console in PyCharm it works fine. (Interpreter in PyCharm is set to /path/to/sample_2/virtualenv/project/bin/python)
Env - 3:
$ virtualenv -p /path/to/pypy /path/to/sample_3/virtualenv/project
$ /path/to/sample_3/virtualenv/project/bin/pip install ipython
Now, when I run the python console in PyCharm it fails with the following error. (Interpreter in PyCharm is set to /path/to/sample_3/virtualenv/project/bin/python)
/path/to/sample_3/virtualenv/project/bin/pypy -u /Applications/PyCharm.app/helpers/pydev/pydevconsole.py 60355 60356
PyDev console: using IPython 0.13.2
Traceback (most recent call last):
File "app_main.py", line 72, in run_toplevel
File "/Applications/PyCharm.app/helpers/pydev/pydevconsole.py", line 361, in <module>
StartServer(pydev_localhost.get_localhost(), int(port), int(client_port))
File "/Applications/PyCharm.app/helpers/pydev/pydevconsole.py", line 288, in StartServer
interpreter = InterpreterInterface(host, client_port, threading.currentThread())
File "/Applications/PyCharm.app/helpers/pydev/pydev_ipython_console.py", line 37, in __init__
self.interpreter = PyDevFrontEnd()
File "/Applications/PyCharm.app/helpers/pydev/pydev_ipython_console_011.py", line 35, in __init__
shell = TerminalInteractiveShell.instance()
File "/path/to/sample_3/virtualenv/project/site-packages/IPython/config/configurable.py", line 318, in instance
inst = cls(*args, **kwargs)
File "/path/to/sample_3/virtualenv/project/site-packages/IPython/frontend/terminal/interactiveshell.py", line 360, in __init__
user_module=user_module, custom_exceptions=custom_exceptions
File "/path/to/sample_3/virtualenv/project/site-packages/IPython/core/interactiveshell.py", line 454, in __init__
self.init_readline()
File "/path/to/sample_3/virtualenv/project/site-packages/IPython/core/interactiveshell.py", line 1843, in init_readline
self.refill_readline_hist()
File "/path/to/sample_3/virtualenv/project/site-packages/IPython/core/interactiveshell.py", line 1851, in refill_readline_hist
self.readline.clear_history()
File "/tmp/pypy-2.0.2/lib_pypy/pyrepl/readline.py", line 284, in clear_history
del self.get_reader().history[:]
File "/tmp/pypy-2.0.2/lib_pypy/pyrepl/readline.py", line 188, in get_reader
console = UnixConsole(self.f_in, self.f_out, encoding=ENCODING)
File "/tmp/pypy-2.0.2/lib_pypy/pyrepl/unix_console.py", line 98, in __init__
curses.setupterm(term, self.output_fd)
error: setupterm: could not find terminfo database
Process finished with exit code 1
Please be mindful that bin/python in any of the virtual environments points to the installed interpreter. For example, /path/to/sample_3/virtualenv/project/bin/python points to pypy and /path/to/sample_1/virtualenv/project/bin/python points to system installed python.
Seems like this is related to this. But, I am not sure.
Please help.
Looking at the actual Exception message, this may be a potential solution:
https://support.enthought.com/entries/22438744-Linux-IPython-in-terminal-error-setupterm-could-not-find-terminfo-database-
Meanwhile, you should be able to work around the problem by setting
export TERM="xterm-256color" in the shell from which you execute ipython,
or in your~/.bashrc file, which you then source.