-
Notifications
You must be signed in to change notification settings - Fork 309
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
Web installer for Windows / Linux #1000
Conversation
I should probably add so far I've tested this on windows 10 and the latest ubuntu 21.10 in a VM |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1000 +/- ##
=======================================
Coverage 96.26% 96.27%
=======================================
Files 40 40
Lines 9342 9357 +15
Branches 1103 1103
=======================================
+ Hits 8993 9008 +15
Misses 205 205
Partials 144 144 ☔ View full report in Codecov by Sentry. |
Thanks, what is the point of not bundling cadquery directly? You have to download it anyway... |
Github has a limit on the size of files that can be put into a release tag (2Gb) |
Post Install FixesI've removed the update to conda in the post install script as I think that seems to break things for some reason Also I've added in the "-c conda-forge -c cadquery" options, I thought those wouldn't be needed due to the conda_default_channels setting, but it looks like they still are for things to work correctly Using from an external non conda pythonOne upside to this is that I've discovered you can now use cadquery from a separate pip based python environment without the need for wheels. Installation:
Add the following to you're python code prior to "import cadquery" (this is the important bit)
This allows you to use the OCP dll's and dependencies installed via conda |
@grbd I'm just getting around to trying this on Linux. It worked just fine on Linux, and I plan to try Windows and MacOS as well. By default the installer installs jupyter-cadquery, which brings a lot of other packages along with it (i.e. zeromq and tornado) that many users won't ever need. Could the jupyter-cadquery install be made optional as part of the install wizard? |
I couldn't see a way to add things to a menu within constructor so I've removed jupyter-cadquery from the install scripts |
Ok, thanks. Here are a few other notes/questions.
|
Or uninstall / re-install the self installer
|
Since the web installer can install any tag of CadQuery (including master), I guess the installer does not have to be tied to a release. It just needs to be available for download from somewhere. The installer code itself probably won't change that much, will it? A couple of other things that I forgot to mention.
|
For the 3.1 issue, that might be a constructor related bug maybe it's picking up
then truncating the version string perhaps The "installer version" can be anything you want, I just used 2.2 as an example it's fairly arbitrary. It's just a label that shows up at least under windows in the list of installed apps in the control panel / name of the installer. However you would need a different installer for each release as you can't just tell it to install a different version when actually doing the install in the wizard, just when you build the installer. Example 1So for example if I run
Example 2
So for a "master" version you could just always use the same installer but for specific versions you'd need one per version. |
Ah, ok. Yes, I wasn't thinking that through. So it sounds like we could create version 2.1 web installers for each OS and then retroatively attach them to the existing 2.1 release. After that the release installer builds could be automated. Then we can create a web installer set to "master" and use that as the development installer, but we'll have to figure out where to store it on the Web. |
Yes thats correct |
I am able to get web installers working well for all three major OSes, so I'm inclined to merge this. The biggest outstanding question is how we will distribute the installers, but that does not have to hold up this PR. @adam-urbanczyk @marcus7070 @lorenzncode do you have any thoughts? |
LGTM, although I am unable to test it out. If we attach this to a GH release, eg. v2.2, then at the time the installer is built v2.2 will not be published to conda-forge yet. So we can't write a CI workflow that will test this installer, right? Which isn't a dealbreaker, just trying to get it clear in my head. |
I think that's correct. We'd have to attach the installers to the releases after the fact. I'm kind of wondering if we should make the installer for the current master (that always installs the bleeding edge) a download from a general location rather than having to attach it to a release. |
I have created web installers for the master branch and put them in a temporary download location. I'll post this to Discord to ask for testers. |
I've used these scripts and they're available to the community at a temporary download location. I'm inclined to merge this as the installers have worked fine on all three OSes. @adam-urbanczyk @lorenzncode what do you think? |
+1 |
I gave the Linux Download script a try. If it's useful for Windows users, or someone unfamiliar with conda, that's great. Perhaps there can also be an option to install cq-editor automatically (yes by default). |
@lorenzncode Is that a request for the future, or are you suggesting that we delay merging until that's added? |
My understanding is this method is intended for users that don't know conda (yet). The description says it will be easier to set up without "accidentally overriding their default paths." Say the user would like to run cq-editor - it must be installed with conda anyway. I wasn't sure whether this method is then much easier compared to a standard miniforge/miniconda install.
Yes, a future enhancement perhaps after more feedback. |
Thanks @grbd ! |
Just to add, another reason for doing this was to try and install cadquery on a default path that's easy to find under windows (or linux as far as the home directory). That way it would open up the possibility of using the conda install from within a pip environment with something like this # cadquery_vloader/__init__.py
import sys
import os
from os import environ, path
# This allows for using cadquery from an external non conda python installation
# Such as a python pip virtual environment
def find_cadquery_conda_dir():
"""Search for installed cadquery conda instance"""
# Search the Home directory
cadquery_home = path.join(path.expanduser("~"), "cadquery")
if path.isdir(cadquery_home):
return cadquery_home
# Search the ProgramData directory for system wide installs
if sys.platform == "win32":
cadquery_progfiles = path.join(environ["ALLUSERSPROFILE"], "cadquery")
if path.isdir(cadquery_progfiles):
return cadquery_progfiles
return None
def import_cadquery_conda(condapath=None):
"""Attempt to locate and import cadquery from an external conda install"""
if condapath is None:
condapath = find_cadquery_conda_dir()
if condapath is not None:
site_dir = path.join(condapath, "lib/site-packages")
sys.path.append(site_dir)
bin_dir = path.join(condapath, "Library/bin")
os.add_dll_directory(bin_dir)
import_cadquery_conda() Then you can just use it like this # testpart.py
import cadquery_vloader
import cadquery as cq
def create_part():
length = 80.0 # Length of the block
height = 60.0 # Height of the block
thickness = 5.0 # Thickness of the block
result = cq.Workplane("XY").box(length, height, thickness)
return result
create_part() You could run into problems keeping the binaries installed under conda and the python files installed via pip in sync. But it would avoid having lots of multiple installs of conda for each virtual environment (which are quite big), instead you can just use one for all virtual pip envs. I've been planning on putting the above example into a seperate python package on github but just haven't gotten around to it yet. |
Hi,
I've written a small constructor script for generating an installer for cadquery
This can be used to generate an exe (windows) or sh (Linux)
which will install miniconda / cadquery onto a windows or linux system
The general idea is to make it easier for windows users to setup without accidentally overriding they're default paths.
The installer doesn't directly include cadquery but instead runs a post install script instead
To download / install the bits needed for cadquery such as opencascade etc
This way the installer is kept to a small size instead of being 2Gb.
The settings for windows are set to not to add to the system path by default
Or override an existing python install in terms of the PATH athough there are tick boxes to change that in the installer gui
I spotted that was something someone mentioned in one of the other issues as a problem, with miniconda changing they're default python.
It may also work for macos as well I'm not sure
There was some suggestion in the constructor docs that the post install stage doesn't work for macos but at the same time they provide an example, so it may or may not work for that one I'm not sure.
I'm not quite sure how to do azure workflows at the moment but I've tried to make it as easy as possible to call
The first parameter being the version number for the installer, the second being the github tag that will actually be installed
To Activate the environment
My eventual plan is to see if it's possible to access the dll's from python from outside of conda
Since these installers put cadquery into a predictable directory path that can be searched for.
using os.add_dll_directory / sys.path.append, although I haven't quite managed that yet.
If nothing else it makes it easier to install and possibly might increase adoption a bit.