Giter Club home page Giter Club logo

Comments (3)

eniven avatar eniven commented on June 2, 2024

I too am having this problem. (Python 3.9.13 Anaconda install on Windows).

from nimpy.

yglukhov avatar yglukhov commented on June 2, 2024

It seems it has more to do with anaconda/venv rather than with nimpy: https://stackoverflow.com/questions/19292957/how-can-i-troubleshoot-python-could-not-find-platform-independent-libraries-pr

I've never used venv so can't tell for sure. I'm open to suggestions if there's anything we can do.

from nimpy.

hmbemba avatar hmbemba commented on June 2, 2024

I was struggling for a while trying to call a python func FROM nim, but the func depends on a library installed in a virtual env

from pyfiglet import Figlet

def test():
    f = Figlet(font='slant')
    print(f.renderText('text to render'))

here is my nim code and here is the compile script

nim c -r main.nim
import strutils
import nimpy

let py = pyImport("main")

discard py.test()

when compiling I would get an error saying the module was not found

Error: unhandled exception: <class 'ModuleNotFoundError'>: No module named 'pyfiglet' [Exception]

I solved this by modifying the sys path IN my python script to add the sitepackages of my venv

import sys
sys.path.append(r'C:\Users\...\Desktop\Scripts\Temp_Projects\nimpy_test_venv_interop_10_06_2023-01_25PM\venv\Lib\site-packages')

from pyfiglet import Figlet
f = Figlet(font='slant')

def test():
    print(f.renderText('text to render'))

from nimpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.