Forum Discussion

mrbartuss's avatar
mrbartuss
Advocate II
5 months ago
Solved

Is %pip install safe for a Python notebook used in a pipeline?

For PySpark workloads in Fabric, custom environments are the recommended standard over inline %pip install to avoid driver/worker sync issues (source). Pure Python notebooks currently lack custom env...
  • 4iurchenko's avatar
    5 months ago

    Hi MR 

    Yes, Python notebooks don't support environments yet. And inline %pip install is the officially recommended best practice now.

     

    Please see the documentation:

    You can use %pip and %conda commands for inline installations, the commands support both public libraries and customized libraries.

    For customized libraries, you can upload the lib files to the Built-in resources folder. We support multiple types of libraries, including formats such as Wheel (.whl), JAR (.jar), DLL (.dll), and Python (.py). Just try drag&drop to the file and the code snippet is generated automatically.

     

    The link to it:

    https://learn.microsoft.com/en-us/fabric/data-engineering/using-python-experience-on-notebook#public-preview-known-limitations

     

    And one more point regarding driver/worker. Python Notebook's architecture is much simplier than Spark notebook, it is their pro. They don't have driver/worker, that's why they use 2 VCores per time comparing to 8+ for Spark notebooks. So, the issue with spreading installation accross drivers/workers should not be an issue.

     

    I hope this helped! If it answered your question, please mark it as a Solution so others with the same issue can find it easily. Kudos are also always appreciated!

     

    BR, Yurri