-
Notifications
You must be signed in to change notification settings - Fork 18.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is caffes Python binding not a package (hosted on PyPI)? #2440
Comments
👍 But, you can't really do this without choosing a version number (#486). |
Hmmm ... I thought this might be as easy as creating a from setuptools import find_packages
from setuptools import setup
import pip.download
from pip.req import parse_requirements
# parse_requirements() returns generator of pip.req.InstallRequirement objects
install_reqs = parse_requirements('requirements.txt',
session=pip.download.PipSession())
# reqs is a list of requirement
# e.g. ['django==1.5.1', 'mezzanine==1.4.6']
reqs = [str(ir.req) for ir in install_reqs]
config = {
'name': 'caffe',
'version': '0.1.0',
'author': 'BVLC members and the open-source community',
'packages': find_packages(),
'scripts': ['bin/classify.py', 'bin/detect.py',
'bin/draw_net.py'],
'platforms': ['Linux', 'MacOS X', 'Windows'],
'url': 'https://github.com/BVLC/caffe',
'license': 'BSD',
'description': ('Caffe is a deep learning framework made with expression, '
'speed, and modularity in mind.'),
'long_description': ('Caffe is a deep learning framework made with '
'expression, speed, and modularity in mind. It is '
'developed by the Berkeley Vision and Learning '
'Center (BVLC) and community contributors.'),
'install_requires': reqs,
'keywords': ['caffe', 'deep learning'],
'download_url': 'https://github.com/BVLC/caffe',
'classifiers': ['Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Software Development',
'Topic :: Utilities'],
'zip_safe': False
}
setup(**config) adjusting the directory structure and it would be done. It turns out that the I am not sure if it would still be better to have this on pip (and give instrucutions what to do when the caffe python package detects that the |
@lukeyeager I could create the package and add an error message with instructions / a link to the docs when the package does not find What do you (or other caffe developers) think about that? |
Here's what I hear you saying, correct me if I'm wrong:
|
The Python documentation would only document the Python code. So in many cases it would still be necessary to look at the "normal" documentation. |
Hang on. If they have to get the C++ source from GitHub (which comes with the python source), why is it helpful to also get the python source through pip? |
It probably isn't helpful to get the source through pip. But it is my first reflex to try it with pip. If the package (when loaded) tells me that I have to compile the caffe code and add caffe to the PYTHONPATH, I know what to do without searching the right point in the docs. Advantages of creating a package and putting it on PyPI are:
|
I see, so this is mostly a documentation/placeholder thing - it wouldn't be super helpful for installing caffe at first, but could become so in the future. Thanks for the clarification. I think for now we should tell people not to use the pip module, even though it will be there, for these reasons:
|
One could make a
The user should not set the |
How does that help pycaffe find the correct library?
I disagree. I only see Maybe there is another direction that we can move this discussion in. If we add the $ cd python && python setup.py install When you install with |
FYI, I tried your $ python setup.py install
running install
running bdist_egg
running egg_info
creating caffe.egg-info
(...)
running install_scripts
running build_scripts
creating build/scripts-2.7
error: file '/home/lyeager/caffe/python/bin/classify.py' does not exist |
Alright, so I have a more complete setup.py here: https://github.com/MicahChambers/caffe/commit/024997fd019f43f8f2b2f5cb932a2492b5d2793f Its probably not what most people want, but anyone wants to build off it, they can. To use you can just point your pip to the branch (probably from a virtualenv) pip install https://github.com/MicahChambers/caffe/archive/master.zip This doesn't use your existing binaries, it just recompiles them and installs them into your python site-packages. Not ideal, but its not like the shared objects come out to be that large. OpenCV and other multi-language packages typically include all the bindings in a package (as in in the .deb file, not as pip packages). That would probably be the best here too; but since there isn't a debian package, and I needed a quick and easy way to install caffe without the fuss of creating my own .deb and hosting it myself, this is the best solution for me right now. No support for GPU or non-atlas blas either. Edit: Correction about OpenCV. |
This issue conflates two different issues. Even the title reflects that:
The first request is fairly easy. It can be restated like this: please include a To correct a statement made by @lukeyeager (if I understood it correctly), it is not true that Python then uses the files in the original directory; instead they get copied to the virtual environment that is currently active (which is usually also somewhere in your home directory). But unlike @MartinThoma I suggest assuming that I have used a slight variant of it (without the The second request is quite different. Personally, I don't like the idea of including a Python-only package on PyPI that just tells you that you haven't really installed caffe after all, especially if it complicates implementing the first request. A more ambitious alternative is possible in principle: Python packages can include C dependencies that get built as part of the installation procedure (and pre-built versions can be uploaded that get selected automatically based on the platform). This is at least as difficult as it sounds; OpenCV hasn't managed it either. |
@arthur-tacca: well said. Adding a working @cdluminate: I expect you would be happy to simplify your debian packaging scripts by using |
setup.py is always better than hardcoded installation path. It helps caffe to standarlize its python installation. I'll be happy to adopt this change whatever it simplifies packaging script or not. |
Still no progress on this? |
@MicahChambers |
This should really be on Pip. A lot more people would use Caffe if it was one command to install, instead of 25. |
@Cloudmersive I think it gets further complicated by different "flavours" of Caffe: |
I agree with @naibaf7 – one may need many different flavors of Caffe with different libraries for different platforms (Intel, ARM, NVIDIA) and different OS to get the best performance. It’s actually the same for Caffe2, TensorFlow, MXNet, etc. If it’s of interest, we are now working on an alternative approach: we created a simple cross-platform package manager in Python which automates installation/building of Caffe, Caffe2, MXNet, TensorFlow with various sub-dependencies on Linux, Windows, MacOS and Android in a unified way. You can find examples here:
We also integrated this package manager with scientific workflows – for example it supports recent ACM tournaments on collaborative optimization of various deep learning algorithms across different data sets, models, libs, frameworks and platforms: http://cKnowledge.org/request . It’s an on-going community project so please stay tuned ;)… We also plan a related event at SuperComputing'18 ... |
@gfursin I checked your work, and honestly is impressive, thanks for it. However, you mentioned in your comment that the package support also MacOs, but I couldn't find any reference in the installation direction. I did install caffe for example, on MacOs with all the dependency, and it was kind of painful (and honestly very long and time consuming). I got excited by your approach, and I thought it could be incredible to speed things up, but apparently MacOs is not present yet, or am I wrong? |
@Dinuz Thanks for your interest and kind words about CK! At the moment, CK considers MacOS as a flavour of Linux. With this in mind, you can actually try the Linux instructions, as @ens-lg4 recently fixed quite a few showstoppers (e.g. see closed issues) |
@psyhtest My pleasure, it's always important recognize the value and the work of people. I am going to follow your suggestions:) |
Hi @Dinuz! Thank you for your interest and sorry that MacOS support is still weak in the CK. The thing is that our main focus was to create a customizable cross-platform package manager with a common API which can be extended by the community, while focusing on various Linux flavour, Windows and Android which was required by our partners and first users. Since we started receiving more requests to support MacOS recently, we just started providing it. @ens-lg4 started porting CK-Caffe (and other DNN frameworks) to MacOS so if something is still not working or there are some bugs, please tell us and/or feel free to open tickets to let us reproduce issues and fix them - CK is a community project and we rely a lot on such feedback to improve and fix things there ;) ! This, in turn, will allow CK users to immediately reuse such improved cross-platform packages for MacOS in their high level and platform independent experimental workflows ... |
@psyhtest thank you so much, it will be really appreciated. @gfursin sorry for what? Thank you for the work you have done already. I am sure the MacOs support will come soon (at the end of the day MacOS is unix flavored system). I am going to test the suit, and I will be more than happy to provide feedbacks and eventually help. |
Nice to virtually meet you too, @Dinuz, and thanks for your encouragement - very appreciated! I am sorry because I am myself often frustrated when things are not working as expected ;) ! I believe @ens-lg4 had a good progress last week building Caffe on MacOS via CK while I updated all ck-caffe* packages to support latest compilers and libraries on Windows, Linux and Android. BTW, I also added support for virtual environments similar to Python but for binary packages built via CK (CK enables co-existence of multiple versions of tools useful to test various functionality or compare versions):
Have a good week! |
Hey, its 2018 now. Have we lost passion for |
Caffe user here chiming in from 2019 - Still no |
becase the people who made caffee themselves were neglectful , purposely sabotaged their own project and ease of installation by yanking the plug on their fast no dependancy pre built win32 binary caffe exe's and instead, due to increasing instabilty (as a result of their own malifence) have decided that the program is more suited to being built from scratch from increasinglier heavier and bloated enviroments, frameworks and enviromental preconfiguraitions rather than 1 click pure win32/64 lean c++ exe why do i need python, to run a npm, to run a scipy, to run a conda to run a pip, to run a ipython-/jupyter notebook to run an pycaffe or pytorch or luajit or caffe?!?!?! That IS the problem with caffe. if their was a 1 step pip3 or conda install of caffe theird be millions of people using it of course, would be useful, but lets rerember you are going out of your way to do extra steps to accomplish something that is superior with much less effort (focus on win32 precompiled binaries and low level hook/wrappers to keep stability, and than once the prebuilt exes are made public again, you write your Pip3 install, which would only be like 6 lines long and the press of the (y) button to get it all installed |
OMG! Why I can't install Caffe on Windows?! 2019 is ending and still no pip/conda support?! |
@arianaa30 Caffe has been superseded by Caffe2 (and PyTorch, which merged with Caffe2). I believe there is no new development on the old Caffe 1.x, so it seems particularly unlikely anyone will go to the effort of producing Windows wheels. BTW, I don't believe that liking your own comment gives it any more weight. |
@arthur-tacca thanks for the info. So caffe2 is already easy to install? (w/ conda or pip?) |
I am wondering why caffe has these installation instructions instead of simply creating a Python package and allowing the user to install it via
If the only reason is time / knowledge how to create such a package, I could do that.
The text was updated successfully, but these errors were encountered: