How to install/use django-inlinecss - django

I need to use this plugin plugin in my app, but i have no idea about how to install and use it. So far, I have found this fork of the mentioned plugin that adds a setup.py script. After issuing the commands python setup.py build and python setup.py install, I added 'django_inlinecss' to my INSTALLED_APPS setting, but still get the following error:
.
. (rest of the traceback)
.
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named django_inlinecss
How can I install this plugin and use it properly?

Sorry about the inconvenience - I didn't realize people had really started to use that library! (It's great to have people actually finding it useful by the way!)
Anyway, I've released it on Pypi, so you should now be able to just do a:
$ pip install django-inlinecss
If you have issues please open a ticket over at:
https://github.com/roverdotcom/django-inlinecss

I had the same problem, so I forked django-inlinecss original repostory and fixed the problem.
You can use
pip install git+https://github.com/fjsj/django-inlinecss.git#18f2f8e5b5453f067dff0d6c0c2ae3066e56d554
to install it successfully. It was missing a packages=find_packages(), line in stevejalim's setup.py.

Related

pip2 causes ImportError: Entry point ('console_scripts', 'pip2') not found

I installed python 2 by
brew install python
I can localise pip2 but not use it. In the terminal i get an error as:
elenama#s2078:~$ pip2
Traceback (most recent call last):
File "/usr/local/bin/pip2", line 11, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip2')()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 570, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2750, in load_entry_point
raise ImportError("Entry point %r not found" % ((group, name),))
ImportError: Entry point ('console_scripts', 'pip2') not found
elenama#s2078:~$ which pip2
/usr/local/bin/pip2
I uninstalled the local python by sudo pip uninstall pip. I also uninstalled python and reinstalled it.
(pip3 works, btw.)
Does anyone have a solution to this problem?
I had the same issue, fixed it by running this
python2 -m pip install --upgrade --force-reinstall pip
Seems to be an issue with current Homebrew Python 2 install. I just installed yesterday and have exactly the same issue (python3 is fine).
I don't have a solution as such, but am able to create a virtualenv with PyCharm, activate that environment, and use pip to install stuff as normal. PyCharm doesn't need virtualenv package to do this.
Since one should use virtualenv (or equivalent) all of the time anyway for real work, it is not so bad a problem that you cannot add packages outside of one. But I think I will file an issue on https://github.com/Homebrew/homebrew-core to see if someone can fix or explain why it is not working.
Also we should all be using Python 3 for everything! This is just one more reminder, as if we needed one.
Need To Install Python2.7 From Here . then restart terminal :
https://www.python.org/downloads/release/python-2714/

PyMC installation error with pip

I am attempting to install PyMC using pip install pymc. I believe this command should install PyMC 2.3.6.
PyMC has a few dependencies, which I have in my PATH. I am running OSX 10.11.2 and my PATH includes Python 2.7.13, NumPy 1.12.0, Matplotlib 2.0.0, gcc, and gfortran.
Python (including pip) was installed using Homebrew. NumPy and Matplotlib were installed using pip. The gfortran compiler was downloaded and installed from the GCC Wiki for the purpose of this installation.
Executing pip install pymc yielded lots of output including the following lines.
Collecting pymc
Using cached pymc-2.3.6.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
running build_src
build_src
building extension "pymc.flib" sources
f2py options: ['skip:ppnd7']
f2py:> build/src.macosx-10.11-x86_64-2.7/pymc/flibmodule.c
creating build
creating build/src.macosx-10.11-x86_64-2.7
creating build/src.macosx-10.11-x86_64-2.7/pymc
IOError: [Errno 2] No such file or directory: 'skip:ppnd7'. Skipping file "skip:ppnd7".
updatevars:gradlike: attempt to change 'dimension(nx)' to 'dimension(na)'. Ignoring.
updatevars:gradlike: attempt to change 'dimension(nx)' to 'dimension(nb)'. Ignoring.
updatevars:gradlike: attempt to change 'dimension (nmu)' to 'dimension(nmu)'. Ignoring.
updatevars:gradlike: attempt to change 'dimension (na)' to 'dimension(na)'. Ignoring.
rmbadname1: Replacing "index" with "index_bn".
Reading fortran codes...
Reading file 'pymc/flib.f' (format:fix,strict)
Line #34 in pymc/flib.f:" PARAMETER (infinity = 1.7976931348623157d308)"
get_parameters: got "unexpected EOF while parsing (<string>, line 0)" on ''
...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/2f/cr97n5v93mn04c3qbqd7r3q40000gn/T/pip-build-6Zmgcz/pymc/setup.py", line 124, in <module>
**(config_dict))
File "/usr/local/lib/python2.7/site-packages/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
...
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/2f/cr97n5v93mn04c3qbqd7r3q40000gn/T/pip-build-6Zmgcz/pymc/
As suggested in these two pip installation threads about egg_info errors [1, 2], I ran pip install —upgrade setuptools and pip install ez_setup. Once these items were installed I ran into the same types of errors pasted above.
As noted in other package installation threads, I am willing to use conda to install PyMC if I cannot resolve these issues. However, I'd like to investigate this installation issue first.
Would anyone happen to know what my issue is here? Might there be some steps I can take to successfully install PyMC using pip?
I had the same problem. I don't understand the root cause, but I fixed it by downgrading numpy to version 1.10.1: pip install numpy==1.10.1
I also met this problem while trying to install pymc from pip or source code, but I found a solution that might be useful.
The reason that causes the problem might be the file setup.py, in which the script check the compile env. I didn't read the code very carefully, but in the function build_ext() I think the codes first check whether some compile environments have already been installed into OS. If installed, the script will use them as defaults; if not, use ones in somewhere else (the comment says 'from netlib sources').
I infer the problem is caused by the compile environments that have already been installed in the OS, so I modify the file setup.py to skip this part of codes, and let the script use the netlib source. Then I run sudo python setup.py install. There are some error and warning messages, but the folder 'pymc' emerges in python library, and some simple test codes run successfully.

How to install and run the reindent.py

I have downloaded the Reindent-0.1.0 and trying to use this for automated indention purpose.
I don't know how to install and run these commands and while I am trying to use this command
I am getting following error
command:
C:\Python26\Scripts\Reindent-0.1.0>Python setup.py
C:\Python26\Scripts\Reindent-0.1.0>Pyth
Traceback (most recent call last):
File "setup.py", line 5, in <module>
from setuptools import setup
ImportError: No module named setuptools
I don't understand the setuptools, where it is and how to put inside
please note my folder files in Reindent-0.1.0
Reindent.egg-info
PKG-INFO
README
reindent
setup.cfg
setup.py
Also how can I run the commands for reindent, for an example, once after I installed the reindent, if I want to
run dryrun command how I should write?
If I write like this, will it be correct ???
C:\ProjFolder\ApplicationDevelopment\GUI>reindent -d Test.py
some realtime example of "-d (--dryrun) Dry run and -r (--recurse) Recurse" will be helpful!!
and where I should target the command file path, in dos
to my application running directory or C:\Python26\Scripts\Reindent-0.1.0 ?? OR Application development folder??
If you get the error "no module X" when you try to run some code, that code has a dependency on module X. When you run setup.py and it says there is no module named "setuptools", it is telling you that setup.py requires the module "setuptools". Since you don't have "setuptools" installed on your machine, you get the error.
The fix is simple: install the setuptools module. Here's one of several places on the internet that shows you how to install setuptools: https://pythonhosted.org/an_example_pypi_project/setuptools.html

ImportError: No module named twisted.internet

I installed python 2.7.5 which is working fine.
I then install scrapy (which, I think, uses twisted internally). My scrapy spider is also working fine.
I installed twisted:
sudo apt-get install python-twisted
Then, I created a sample program using Echo Server code shown here
Here is the code
from twisted.internet import protocol, reactor
class Echo(protocol.Protocol):
def dataReceived(self, data):
self.transport.write(data)
class EchoFactory(protocol.Factory):
def buildProtocol(self, addr):
return Echo()
reactor.listenTCP(1234, EchoFactory())
reactor.run()
I try to run this code using this command:
$ python twistedTester.py
Traceback (most recent call last):
File "twistedTester.py", line 1, in <module>
from twisted.internet import protocol, reactor
ImportError: No module named twisted.internet
Can anyone help me with how I can debug why my twisted package is not being picked up by Python installation?
If you use pip just try:
pip install twisted
The same works with w3lib and lxml.
On some *nix systems this might give you a permission error. If that happens, try:
sudo -H pip install twisted
I figured out why this error was happening. For some reason, using apt-get to install a python package was not installing it right.
So, I had to download a tar ball and install the package from them.
I downloaded Twisted tar from here.
I did a tar xjf Twisted-13.1.0.tar.bz2 - this created a directory called Twisted-13.1.0
next, cd Twisted-13.1.0
Finally, python setup.py install
This gave me an error. Twisted required another package called zope.interface. So, I downloaded tar ball for zope.interface from here. Then, ran this command tar xzf zope.interface-3.6.1.tar.gz That created a folder called zope.interface-3.6.1. So, cd into zope.interface-3.6.1 and run python setup.py install
Note: Depending on your user's rights, you may want to do these commands in sudo mode. Just add the keyword sudo before every command.
please rename the file twisted.py to something else. whenever you import a function from a file the interpreter will search for the file in the current location and then it searches in the library. so if you have any file in the name of "twisted.py" you should probably rename it.
after renaming it. dont fail to remove the twisted.pyc file before running it again.
It happened to me too. Finally I figure out that there is a file named twisted.py my present working directory. I removed twisted.py and twisted.pyc. Problem resolved.
Looks like Twisted may have removed the twisted.internet module from the current release. Pinning on the version required by scrapy (17.9.0) worked for me:
$ pip install twisted==17.9.0
Checking if it's installed:
$ python -c "import twisted.internet; print(twisted.internet)"
<module 'twisted.internet' from '/Users/username/dev/env/redacted-ewmlD2h2/lib/python3.7/site-packages/twisted/internet/__init__.py'>
I figured out why apt-get install python-twisted was not enough or "installing it right", as you said, user1700184.
I use Debian Wheezy and Python 2.7.
I just had to move the folder named "twisted" from /usr/lib/python2.7/dist-packages/ to /usr/lib/python2.7/
The same has to be done with the package "zope" and any other one that you do install but is not retrieved when you try run your code.
However, why this is even necessary in my case is still a mystery since my sys.path does include both /usr/lib/python2.7/ and /usr/lib/python2.7/dist-packages, so whatever was under dist-packages should have been retrieved by the interpreter.
I think it is worth noting that if you use sudo to launch python you are using your original default system python. This is NOT the python that your PATH points to. For example if you are using Anaconda and you have updated your path such that which python points to path/to/anaconda/bin/python, sudo which python will still point to usr/bin/python.
So obviously sudo python twistedTester.py will not find the twisted module. To get around this you should explicitly pass the path to the anaconda python. Like so:
sudo path/to/anaconda/bin/python twistedTester.py

Build numpy for python3 when python not installed in /usr

Fedora 18, x86_64.
Okay, so:
I have installed python3 in ~/utils/src/python3/Python-3.3.0/ so that it's available on NFS and I don't have to reinstall it on every machine in the lab.
I want to install numpy.
I got the source, it's in ~/utils/src/python3/numpy-1.7.0/ When I run python3 ./setup.py, I get:
file "~/utils/src/python3/Python-3.3.0/Lib/distutils/text_file.py", line 115, in open
self.file=io.open(self.filename, 'r', errors=self.errors)
FileNotFoundError: [Errno 2] No such file or directory:
'/usr/local/lib/python3.3/config-3.3m/Makefile'
Going up the stack, I get to sysconfig.py, line 435, which seems to generate the path name by calling get_makefile_filename, which is in sysconfig.py, line 251. It accesses globals (python_build, _sys_home, and a bunch of others), and I'm not sure how they're configured.
I tried passing --prefix=~/utils/src/python3/Python-3.3.0 to setup.py, but got nowhere. (And I'm not sure what exactly --prefix does anyways)
Has anyone had luck installing packages with nonstandard python3 installs?
Thanks,
Charles.
Okay, so here's the thing: distutils.sysconfig uses sys.executable, which is the location of the python executable. If this file is in the python build directory, then it will try to put everything in /lib. This was happening to me because I had a symlink from ~/utils/bin/python3 to ~/utils/src/python3/Python-3.3.0/python. sys.executable returned ~/utils/bin/python3, which was not in python's build directory.
Invoking the command as ~/utils/src/python3/Python-3.3.0/python setup.py got it to work.
I picked an arbitrary prefix (actually /dev/shm) and then copied everything that belonged in site-packages to ~/utils/src/python3/Python-3.3.0/Lib/site-packages/numpy, and it seems to work for now.